[OSM-dev] Coordinate to Pixel at lowzoom

Lynn W. Deffenbaugh (Mr) ldeffenb at homeside.to
Thu Oct 8 02:36:34 BST 2009


Greetings,

I've searched the list archives, but didn't spot this question, so here 
goes.

I'm developing a client that uses OpenStreetMap tiles and overlays 
coordinate (lat/lon) information above it.  It's custom C coded, so I 
can't use any of the libraries out there.

I understand the discussion on the following URL about the tile names 
and the long2tilex, lat2tiley, tilex2long, and tiley2lat functions.

http://wiki.openstreetmap.org/index.php/Slippy_map_tilenames

However, at zoom levels less than 4 (or so), I get a worsening offset to 
the north and south of the equator as I map objects onto the maps.  You 
can see this effect at the following URL:

http://tinyurl.com/OSMLowZoom
or
http://ldeffenb.dnsalias.net.nyud.net/OSM/LowZoom.htm

I'm using the floating-point X/Y value scaled by 256x256 to position the 
X/Y within a single tile.  This works fabulously for the higher zooms, 
but, as you can see, completely misses the continental land masses for 
the lower zooms.

Is there a different/better set of equations to use at lower zooms?  Or 
is the project just that strange?

Lynn (D) - Author of APRSISCE for Windows Mobile - An Amateur Radio tool




More information about the dev mailing list