[OSM-dev] Plotting a point on a tile
Rogier Wolff
R.E.Wolff at BitWizard.nl
Fri Aug 15 09:04:19 BST 2008
> Assume: Latitude = 52.478624 and Longitude= -1.913584 which is the
> centre of Birmingham, UK.
> Using the code supplied on
> http://wiki.openstreetmap.org/index.php/Slippy_map_tilenames#Tiles
> I can calculate that at zoom level 18, my x and y tiles are 129678 and
> 86020, so I get a tile URL of
> http://tile.openstreetmap.org/mapnik/18/129678/86020.png
> Now obviously the map tiles don't line up exactly with my coordinates,
> so I use the formulas on the wiki to get the tile edges: north
> east=(52.4794347,-1.9129943) and SW=(52.47859,-1.91436).
> I think I need to offset the tiles pixel location on screen by a
> certain amount so that I get my required point on the centre of the
> map, but this is where I'm getting stuck. Using the latitudes from
> these I can calculate that each tile is 92.942metres wide at zoom 18,
> or 0.363m per pixel - does this help?
Your tile spans .0008477 degrees.
Your point is .000034 degrees from the south edge, which is 4.025 % of
the range of the tile. which, times 250 (pixels per tile) = 10 pixels.
Same for east-west.
Roger.
--
** R.E.Wolff at BitWizard.nl ** http://www.BitWizard.nl/ ** +31-15-2600998 **
** Delftechpark 26 2628 XH Delft, The Netherlands. KVK: 27239233 **
*-- BitWizard writes Linux device drivers for any device you may have! --*
Q: It doesn't work. A: Look buddy, doesn't work is an ambiguous statement.
Does it sit on the couch all day? Is it unemployed? Please be specific!
Define 'it' and what it isn't doing. --------- Adapted from lxrbot FAQ
More information about the dev
mailing list