[OSM-talk] How to georeference OSM Mapnik tiles?

Jon Burgess jburgess777 at googlemail.com
Fri Nov 30 12:00:00 GMT 2007


On Fri, 2007-11-30 at 12:45 +0200, Rahkonen Jukka wrote:
> > Lähettäjä: Martijn van Oosterhout [mailto:kleptog at gmail.com] 
> > <Jukka.Rahkonen at mmmtike.fi> wrote:
> > > I would like to convert some OSM tiles to geotiff format, 
> > but I wonder 
> > > how can I get the georeferencing information I need for it. What I 
> > > would need to know is:
> > > - Which projection the tiles are in (EPSG code or projection 
> > > parameters)
> > 
> > It's not as official projection, though people refer to it as 
> > EPSG:90013. It's also known as spherical mercator, the same 
> > as google uses. The usual definition is:
> > +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 
> > +x_0=0.0 y_0=0 
> > ++k=1.0 +units=m +nadgrids=@null +no_defs
> 
> Thanks, that's exactly what I needed.
> 
> > > - Pixel size for each zoom level
> > Zoom 0 is 256x256, each zoomlevel down is twice as big as the 
> > previous in each dimension
> 
> Sorry for being unclear, I meant to ask "What are the dimensions of a single pixel (width and heighth) in geographical units in the real world?" The unit seem to be meter according to the definition above.

The world is divided up into a square of 256 * 2^zoom pixels.
There is not a 1:1 mapping between these pixels and the real world
because the mercator projection varies its scale over latitude.

At the equator each pixel would be approximately:
4 * 10^7 / (256 * 2^zoom) metres
and gets smaller as you move towards the N/S poles.

> > > - What is the anchor point of the tile and its corresponding 
> > > coordinates
> > Zoom 0 has 1x1 tiles, Each zoomlevel down has twice as many 
> > in each direction
> 
> Here I meant to ask what is the most natural point to use as reference point, for example the top-left corner of top-left pixel of each tile. But I think I will be able to solve this by the reference you sent.

The (0,0) tile of any zoom is in the top left corner of the map. It
would probably make sense to use this corner as the reference for any
pixel offset within the tile.

You may be interested in this thread too:
http://lists.openstreetmap.org/pipermail/dev/2007-November/007969.html


> -Jukka Rahkonen-
> 
> _______________________________________________
> talk mailing list
> talk at openstreetmap.org
> http://lists.openstreetmap.org/cgi-bin/mailman/listinfo/talk





More information about the talk mailing list