This is a static archive of our old OpenStreetMap Help Site. Please post any new questions and answers at community.osm.org.

function between latitude and tile number

0

Hi,

I am a developer and I need the function y=f(x)=? between the latitude (=x; -90 <= x <= 90) and the tile number on zoom level 16 (=y; 0 <= y <= 65536) for my mobile game. I exported the osm tiles with Maperitive and I need to convert the gps position of the phone to the tile number (x, y). I already have an algorithm to determine the x value of the tile number but I need the y value too. I can get the function by myself, but I would need to spend days on getting an accurate function because it seems to be a function with a degree over 10.
So anyone knows the function? Or maybe how to convert the tile numbers to meters? If you're wondering why I don't just simply implement osm to my game ... one reason is that I need to deactivate some labels for my game.

I attached three screenshots with the graph, the value table and the tiles for better understanding.

Full graph:

full graph

Part of the graph with value table:

alt text

Tiles generated with Maperitive (zoom level 16):

alt text

asked 26 Jun '17, 18:53

Time2Design's gravatar image

Time2Design
15223
accept rate: 0%


One Answer:

3

answered 26 Jun '17, 19:20

maxerickson's gravatar image

maxerickson
12.7k1083176
accept rate: 32%

thank you!

(26 Jun '17, 20:26) Time2Design

Source code available on GitHub .