Opened 6 years ago

Last modified 6 years ago

#5018 new defect

what are the coordinates of a generated .PNG map

Reported by: james_7114737 Owned by: rails-dev@…
Priority: minor Milestone:
Component: website Version:
Keywords: static map image coordinates Cc:



I am writing a Android app which will use static map images, and was hoping to refer to as a source of maps. However for the maps to be of use in my app the map corner coordinates need to be known.

The old website allowed for the generated of static map images (e.g. .png). The coordinates of the map image generated were obviously displayed on the website.

The new website still allows for generation of static map images, but the coordinates of the map image are unknown.

Go to:
Zoom in on the map
Click the Share button on the right.
Check Set Custom Dimentions
Drag box edges as desired.
Adjust the scale as is desired.
Click Download.
A wonderful map has been generated, but I do not know what the coordinates are. Are they elsewhere on the web page and I am not seeing it, or embedded in the image or anything?


Change History (9)

comment:1 Changed 6 years ago by Tom Hughes

Well you shouldn't be hooking up an app to that interface anyway - that is for one time exports by users interacting directly with our web site and not for any sort of programmatic use.

comment:2 Changed 6 years ago by RobJN

@TomH : I don't mean to be negative as you all do great work on OSM, but I would be interested in the reason why?. If we are allowing people to get tiles, then what is so different about the png export feature as long as it's for "fair use" only?

comment:3 Changed 6 years ago by Tom Hughes

Because it's a very expensive call for us - every call to that script is a custom render from the database.

comment:4 Changed 6 years ago by pnorman

The export call can't take advantage of any tile caching, either on the edge cache servers or the render servers. Some back of the napkin calculations put it as about as expensive as 5000 tiles in terms of server resources.

The tile usage policy covers the export call.

Aside from all of this if the server load is above a certain point the export call shuts down to prioritize tile rendering.

That being said, there probably is room for UI enhancements so that you know where you're rendering.

comment:5 Changed 6 years ago by james_7114737


The users of my app would be using the OpenStreetMap web interface above on their computer and then copying any generated static map image data to their mobile devices manually. The reason that my app is using static maps is for use in regions that do not have access to mobile data - i.e. no cell phone service...

Presuming the underlying tile data is conveniently gridded: to ease computing resources, would an option would be to grow the requested map a bit to exactly match the underlying tile edges so that the coordinates are a more straightforward lookup? i.e. use 100% of all required tiles for the smaller requested area? I am typing in ignorance on this suggestion, but it is something I would check for if I was coding this as a quick and easy solution...


comment:6 Changed 6 years ago by woodpeck

If your application would do the calculations (which tiles required for the static map in question) and then download these tiles and combine them into an image itself, then you wouldn't need the custom rendering capabilities of the web site and your application would be more resource friendly. Your application would still have to abide by the aforementioned tile usage policy, and take care not to run afoul of bulk downloading rules. There are some "static map" scripts out there that already do the maths, or you could check out for code about how to get from coordinates to tile numbers.

comment:7 Changed 6 years ago by RobJN

In regards to the bug request, then I agree with pnorman that UI improvements would be nice (but probably low priority for most people). You could even have the PNG files georeferenced by including a .wld "World File" with the download.

@TomH : Thanks.

@james_7114737 : It seems to me that your best option is to use the tile servers to get tiled map images. This way your users won't have to do a manual load into the app. All they will have to do is have the app cache a small number of tiles for offline use whilst on a wifi network. Tiles are served up using the TMS standard/service.

comment:8 Changed 6 years ago by james_7114737


My app does not even support Internet communication (no sockets), so unfortunately SW changes in my app are not a solution: it is not the point of communication with openstreetmap, or any other mapping resource. People would use static internet access and web browser of choice to download whatever static map imagery is of interest to the user (street map data from openstreetmap, bathymetry and satellite imagery from other websites, etc.).

People in cities already have access to multiple GEO solutions through their data plans; my app doesn't fit into that category. Agreed that this request is not the largest user base.

One point I am confused about: the user is actively selecting an area of interest in the website when exporting or when sharing. The coordinates are displayed/enterable when exporting, and are not displayed when sharing. I even tried without success to draw the same selection areas simultaneously to determine the coordinates of the shared area...

The other point to make: it was there before in the previous website... 8-).


comment:9 Changed 6 years ago by woodpeck

True it was there before, and I for one do miss the coordinate display on image export selection, but I guess we're the minority here. I could think of a number of ways in which you could probably solve the issue but discussing this in a trac bug report becomes awkward. Would you mind switching to the dev@… list and simply ask your question there in short form? That would also increase the chance of others chiming in with a good idea or two.

Note: See TracTickets for help on using tickets.