Calculate lot/lan for each pixel of a tile

Hello,

for an application I need to put dots at specified lat/long on an osm tile, i’ve found many examples that shows how to calcute the needed tile for a given lot./lan. but couldn’t find anything of how to calculate lot/lan for each pixel of the tiles. Somebody now’s how this could be (simple?) done?

Thanks, Lars

You found that here? http://wiki.openstreetmap.org/wiki/Slippy_map_tilenames#lon.2Flat_to_tile_numbers

So you can calculate xtile and ytile from lat,lon by using lat2tile() and long2tile().

The reverse can be done with tile2long() and tile2lat(). This gives you the lat,lon of one of the corners of the tile. Calculate also lat,lon of the next tile. As every tile is 256x256 pixels you can spread out 256 pixels linear over de latdiff = xlat2-xlat2. The same for lon. At high resolution this will work.