[OSM-dev] Plotting a point on a tile

Michael Willigens michael at willigens.de
Sat Aug 16 21:44:10 BST 2008


however, what if someone wants to draw a point on a low scale tile? 
using the mentioned way will result in a displaced point to the north. 
does somebody has a proper formular to get lon/lat/zoom int x/y coords 
to a low zoom tile?


p.s.: sry at martijn for doublicated mail :>

Martijn van Oosterhout schrieb:
> On Fri, Aug 15, 2008 at 9:46 AM, Water Explorer Support
> <support at waterexplorer.co.uk> wrote:
>> I can calculate and display the tiles without any issues, but the problem
>> I'm having is actually plotting a point accurately on the tile.
>> Heres what I do so far:
>> 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
> You're really close: those formulae at some point truncate the number
> they get to an integer, raw they produce something like 129678.xxx and
> 86020.yyy. If you take those fractional parts and multiply by the size
> of the image (in this case 256) it gives you the offset within the
> image.
> Hope this helps,

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3843 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://lists.openstreetmap.org/pipermail/dev/attachments/20080816/0d700ec0/attachment.bin>

More information about the dev mailing list