NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum

I am interested using a slippy map to download OSM tiles. In doing so, I intend to stay within OSM tile usage policies (such as setting up my own tile server, or renting space from a commercial server) for high volume use).

I noticed the official openstreetmaps.org slippy map has an 'export' tab, grabbing sections of map at a given zoom level. I have a few questions about this:

  • How would I deploy a slippy map with the 'export' tab enabled?
  • When exporting a tile layer (say, Mapnik) to an image format (jpeg or png) how is the bounding box determined? Is the export function grabbing the nearest whole tiles (grabbing extra tile area) or is it generating an image that aligns with the users' view window, cut to the pixel?
  • Is there an API sufficient to allow me to trigger this command programatically over a series of zoom levels, with the same bounding box?

asked 07 Feb '12, 23:24

benford's gravatar image

benford
21113
accept rate: 0%


The export tab is a complex beast that does a number of technologically very different things.

For "Mapnik" style raster images, the request is forwarded to code that runs on the tile server, where a Mapnik installation and an up-to-date osm2pgsql-generated OSM database are available to generate custom renderings. This will not export tiles in any way, but render the precise rectangle in the precise resolution chosen. To mimick that, you would have to have the same technology in place. Essentially you could use generate_image.py or nik2img.py to simulate what goes on there; I would also suggest these command line utilities as your "API to allow you to trigger this command programmatically".

For raster images in the soon-to-be-removed "Osmarender" style, the backend will indeed use existing tiles and paste them into an image, cropping it to match the requested area. I don't know the exact implementation but it is bound to be something like the scripts featured on the Static map images page on the Wiki. Those scripts are also what you would use if you had your own tile server and wanted to create static "pasted tiles" images of that.

permanent link

answered 08 Feb '12, 10:16

Frederik%20Ramm's gravatar image

Frederik Ramm ♦
82.5k927201273
accept rate: 23%

That's just what I was looking for, thanks. Would there be a publicly available source from which I can download the mentioned python scripts?

(08 Mar '12, 16:55) benford

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×315
×83

question asked: 07 Feb '12, 23:24

question was seen: 9,458 times

last updated: 08 Mar '12, 18:44

NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum