[OSM-dev] Osmosis Bug Report: Node TileIDs Incorrect

Martijn van Oosterhout kleptog at gmail.com
Sun Apr 27 14:37:35 BST 2008


On Sun, Apr 27, 2008 at 1:34 PM, Tom Hughes <tom at compton.nu> wrote:
>  > >        x = (int) Math.floor((longitude + 180) * 65536 / 360);
>  > >        y = (int) Math.floor((latitude + 90) * 65536 / 180);

>  Yep - the input (after adjusting to zero) is between 0 and 360 (for
>  the longitude) or 0 and 180 (for the latitude) and we want to produce
>  a 16 bit integer so the result needs be between 0 and 65535 or we will
>  overflow sometimes.

Interesting. so the area covered by the quadtiles at the edge of the
map is half that of the rest of the tiles. Was this scheme chosen
specifically or is it just the way it was done at the time.

If s = 360/65535 then:
quadtile 0,0 is [0,0.5s]left/right and [0,1s] up/down
quadtile 1,1 is [0.5s,1.5s]left/right and [1s,3s] up/down

Have a nice day,
-- 
Martijn van Oosterhout <kleptog at gmail.com> http://svana.org/kleptog/




More information about the dev mailing list