Questions Tagged With pnghttps://help.openstreetmap.org/tags/png/?type=rssquestions tagged <span class="tag">png</span>enThu, 10 Jan 2019 19:13:41 +0000Script to obtain imageshttps://help.openstreetmap.org/questions/67535/script-to-obtain-images<p>We have a list of specific lat/lon coordinates in a spreadsheet that we'd like to have images for. We have the OpenStreetMap query strings ready to go, but need a more automated way to pull the images rather than manually. Anyone else tackled this yet? Perhaps with a script?</p>
<p>The images would need to be available offline, so we need static PNGs (or similar) that would look OK on mobile. Specific locations are landmarks that don't change often, so real-time not critical. Not stuck on specific size yet, so that's flexible. 1200 x 900 to start?</p>jjdepriscoThu, 10 Jan 2019 19:13:41 +0000https://help.openstreetmap.org/questions/67535/script-to-obtain-imageslatlonimageexportpngperl mkmap.pl > mymap.pnghttps://help.openstreetmap.org/questions/66895/perl-mkmappl-mymappng<p>Hi</p>
<p>Like the following manual <a href="https://wiki.openstreetmap.org/wiki/DE:Bigmap">https://wiki.openstreetmap.org/wiki/DE:Bigmap</a> I downloaded a mkmap.pl file. With perl mkmap.pl &gt; mymap.png I tried to create a png file.</p>
<p>During the download sometimes appears:
<a href="http://tile.openstreetmap.org/11/1097/729.png...">http://tile.openstreetmap.org/11/1097/729.png...</a> 500 Status read failed: Eine vorhandene Verbindung wurde vom Remotehost geschlossen.</p>
<p>Sometrimes appears:
<a href="http://tile.openstreetmap.org/11/1095/745.png...">http://tile.openstreetmap.org/11/1095/745.png...</a> 500 Can't connect to tile.openstreetmap.org:80 (Invalid argument)</p>
<p>Mostly appears:
<a href="http://tile.openstreetmap.org/11/1096/748.png...">http://tile.openstreetmap.org/11/1096/748.png...</a> 200 OK</p>
<p>After about 1 hour appears:
&lt;html&gt;&lt;head&gt;
&lt;meta http-equiv="cache-control" content="no-cache"&gt;
&lt;meta http-equiv="pragma" content="no-cache"&gt;
&lt;meta http-equiv="refresh" content="0;url=/ui/dboard"&gt;
&lt;/head&gt;&lt;/html&gt;
not found: Invalid argument at C:/Perl64/lib/GD/Image.pm line 64.</p>
<p>At the end, normally the png-file is empty. Once I had a png File (93MB) but with many white squares.</p>
<p>What do I wrong?</p>
<p>Thanks and best regards!</p>
<p>my mkmap.pl file contains:</p>
<h1>!/usr/bin/perl</h1>
<h1>generated from <a href="http://openstreetmap.gryph.de/bigmap.cgi/">http://openstreetmap.gryph.de/bigmap.cgi/</a></h1>
<h1>permalink for this map: <a href="http://openstreetmap.gryph.de/bigmap.cgi?xmin=1066&amp;xmax=1121&amp;ymin=715&amp;ymax=751&amp;zoom=11&amp;scale=256&amp;baseurl=http%3A%2F%2Ftile.openstreetmap.org%2F%21z%2F%21x%2F%21y.png">http://openstreetmap.gryph.de/bigmap.cgi?xmin=1066&amp;xmax=1121&amp;ymin=715&amp;ymax=751&amp;zoom=11&amp;scale=256&amp;baseurl=http%3A%2F%2Ftile.openstreetmap.org%2F%21z%2F%21x%2F%21y.png</a></h1>
<h1></h1>
<p>use strict;
use LWP;
use GD;</p>
<p>my $img = GD::Image-&gt;new(14336, 9472, 1);
my $white = $img-&gt;colorAllocate(248,248,248);
$img-&gt;filledRectangle(0,0,14336,9472,$white);
my $ua = LWP::UserAgent-&gt;new();
$ua-&gt;env_proxy;
for (my $x=0;$x&lt;56;$x++)
{
for (my $y=0;$y&lt;37;$y++)
{
my $xx = $x + 1066;
my $yy = $y + 715;
foreach my $base(split(/\|/, "http://tile.openstreetmap.org/11/!x/!y.png"))
{
my $url = $base;
$url =~ s/!x/$xx/g;
$url =~ s/!y/$yy/g;
print STDERR "$url... ";
my $resp = $ua-&gt;get($url);
print STDERR $resp-&gt;status_line;
print STDERR "\n";
next unless $resp-&gt;is_success;
my $tile = GD::Image-&gt;new($resp-&gt;content);
next if ($tile-&gt;width == 1);
if ($base =~ /seamark/) {
my $black=$tile-&gt;colorClosest(0,0,0);
$tile-&gt;transparent($black);
}
$img-&gt;copy($tile, $x<em>256,$y</em>256,0,0,256,256);
}
}
}
binmode STDOUT;
print $img-&gt;png();</p>test99Fri, 23 Nov 2018 22:38:58 +0000https://help.openstreetmap.org/questions/66895/perl-mkmappl-mymappngdownloadpngperlMap layers and .png outputhttps://help.openstreetmap.org/questions/61588/map-layers-and-png-output<p>I'm having trouble with two things.</p>
<p>The first is that I want 2 maps, one without roads or highway shields and a second with only roads and highway shields in order to insert a traffic layer between them.</p>
<p>The second is that I would like to download, using C#, a .png file of each map described above.</p>
<p>In javascript using leaflet, this seems to support this download, but it seems to derived from the leaflet.js.</p>
<p>new L.TileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png');</p>
<p>Any help with these would be welcome and appreciated.</p>
<p>Thank you</p>chascallawayThu, 11 Jan 2018 18:19:40 +0000https://help.openstreetmap.org/questions/61588/map-layers-and-png-outputlayersusagepngMap with leaflet and custom data layers - render to image?https://help.openstreetmap.org/questions/52341/map-with-leaflet-and-custom-data-layers-render-to-image<p>We are using OSM (recently) to provide relatively <a href="https://www.checkin.com/db/">large maps</a> with custom layers based on the municipalities of Europe (image shows an example). One of the issues we have is that the data to be transmitted is simply huge: The largest I've seen is example MUC "percentage" with 30MB mapdata via JSON, that takes a while to "load".</p>
<p>Some of our users sit in regions where "high speed internet" still is a dream or need access "on the road" with bad connectivity. In order to reduce the size, the best would be, if we could create the map on the server, save it to an image file (PNG preferred) and then just deliver the resulting image as a "placeholder" or preview in the dashboard, clicking to "activate" the interactive map. We tried several approaches, but failed. The closest was PhantomJS, but that also failed on the larger maps (timeout problem, difficult to cover up for).
The "common" functions render/safe the maps, but not our layers, which makes it useless for our need or do we (I) miss anything here?
Individual Screenshots for more than a thousand possible maps is also not an option.</p>
<p>As I believe that might be a more "common" problem... Any ideas anyone?</p>
<p>Thanks a million!</p>
<p>Juergen (newbie)</p>
<p><img src="https://www.checkin.com/resources/osm_ml_example.jpg" alt="alt text"></p>Osm_ccomMon, 03 Oct 2016 13:12:40 +0100https://help.openstreetmap.org/questions/52341/map-with-leaflet-and-custom-data-layers-render-to-imagelayersleafletdatapngrenderingget_map map grabbing failedhttps://help.openstreetmap.org/questions/50007/get_map-map-grabbing-failed<p>I am trying to use R to download a map but am getting a map grabbing failed message:</p>
<p>mapImage &lt;- get_map(location = c(lon = -87.89, lat = 43.05),color = "color",source = "osm",zoom = 6)
Map from URL : <a href="http://maps.googleapis.com/maps/api/staticmap?center=43.05,-87.89&amp;zoom=6&amp;size=640x640&amp;scale=2&amp;maptype=terrain&amp;sensor=false">http://maps.googleapis.com/maps/api/staticmap?center=43.05,-87.89&amp;zoom=6&amp;size=640x640&amp;scale=2&amp;maptype=terrain&amp;sensor=false</a></p>
<p>Error: map grabbing failed - see details in ?get_openstreetmap.
In addition: Warning message:
In download.file(url, destfile = destfile, quiet = !messaging, mode = "wb") :
cannot open URL 'http://tile.openstreetmap.org/cgi-bin/export?bbox=-94.910263671875,37.6894455061226,-80.847763671875,47.9652621160178&amp;scale=10000000&amp;format=png': HTTP status was '0 (null)'</p>erikwantaSat, 04 Jun 2016 08:40:06 +0100https://help.openstreetmap.org/questions/50007/get_map-map-grabbing-failedrexportpngerrorRender a static image (png, jpg...) of a map with a lightweight toolchainhttps://help.openstreetmap.org/questions/33398/render-a-static-image-png-jpg-of-a-map-with-a-lightweight-toolchain<p>I am looking for a really simple thing: Getting a image of a map. I already found some solutions like using openlayers and capturing a screenshot of a openlayers site with phantom js (requires qt) or a solution like the one posted here: <a href="https://help.openstreetmap.org/questions/23034/maps-to-static-image-to-be-stored-on-a-mobile-application">https://help.openstreetmap.org/questions/23034/maps-to-static-image-to-be-stored-on-a-mobile-application</a>
But this uses Mapnik, which has a bunch of dependencies. Since I want to generate the mapimages on a slim <strong>ARM</strong> linux, I need a much more lightweight solution, with less dependencies.</p>
<p>Any ideas? :)</p>
<p>Edit: So what do I want to achieve?</p>
<ul>
<li>Map should be offline accessible</li>
<li>Display a map with markers and polygons in a mobile QtQuick Application</li>
<li>-&gt; QtQuick Application can't render html files (because it runs on android)</li>
<li>-&gt; My idea for displaying maps: The app communicates with an arm linux machine (which is already used for the app), which sends preprocessed pictures of the currently needed map.</li>
</ul>DerMasFri, 23 May 2014 09:24:40 +0100https://help.openstreetmap.org/questions/33398/render-a-static-image-png-jpg-of-a-map-with-a-lightweight-toolchainopenstreetmapmapimageimagepngmapExport osm PNG (JPEG) from LatLng bounds with current resolutionhttps://help.openstreetmap.org/questions/31916/export-osm-png-jpeg-from-latlng-bounds-with-current-resolution<p>For example I want to export osm map (or other, cloudmade for ex.)
with</p>
<pre><code>LatLngBounds {
minLat = 10.75643453;
minLon = 11.23422344;
maxLat = 34.32434234;
maxLon = 20.23423445;
}
</code></pre>
<p>and resolution: </p>
<p>4000 x 4000 px
or 10000 x 10000 px</p>
<p>How can i do that? Thanks. Maybe you know site with generete it not free?</p>EvmWed, 26 Mar 2014 12:45:44 +0000https://help.openstreetmap.org/questions/31916/export-osm-png-jpeg-from-latlng-bounds-with-current-resolutionbigimageexportpngjpegGenerating a png file from Big Maphttps://help.openstreetmap.org/questions/24643/generating-a-png-file-from-big-map<p>After generating a Big Map of the area that I need, I click perl and download the mkmap.pl file, but then my windows 8 computer just wants to open the file in word or notepad. How do I 'run' it in order to get the png file?</p>Karina OconnorSun, 28 Jul 2013 11:19:09 +0100https://help.openstreetmap.org/questions/24643/generating-a-png-file-from-big-mappngperlExporting large map for museum use?https://help.openstreetmap.org/questions/15476/exporting-large-map-for-museum-use<p>Hello,</p>
<p>I'm wondering if there's any way to download 1,242 km² at a relatively high scale, perhaps 6800 or 14000? The Peel Art Gallery, Museum and Archives would like to use such an image in an interactive display, that would toggle between a historic map from the late 1800s and the OSM data.</p>
<p>I'm presuming not many museums have publicly, permanently used OSM data, so I'm hoping the unique situation might attract some sympathy. I've read through some of the similar questions on this forum, and poked around some of the sites listed, but many require a download, which I can't do on my municipal computer. Also on this municipal computer, MapOSMatic's first tab doesn't seem to work.</p>
<p>The file being toggled with is 17099 x 22387 pixels, but it includes lots of periphery engravings, so the contemporary map wouldn't need to be that scale. And while I'm listing pixel dimensions, SVG/PDF would be fine as well.</p>
<p>Nick Moreau<br>
Reprographics specialist<br>
Peel Art Gallery, Museum and Archives</p>NickMoreauFri, 24 Aug 2012 14:18:11 +0100https://help.openstreetmap.org/questions/15476/exporting-large-map-for-museum-usemuseumexportpngHow do I generate a 20,000 x 20,000px png?https://help.openstreetmap.org/questions/9859/how-do-i-generate-a-20000-x-20000px-png<p>If I wanted to generate a 20,000 by 20,000 png for a particular location, is that possible? It seems whenever I tried to export a tile via an http query it will only allow a height of 2,000? </p>johnmciMon, 09 Jan 2012 00:57:26 +0000https://help.openstreetmap.org/questions/9859/how-do-i-generate-a-20000-x-20000px-pngexportpng