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

[closed] How to convert longitude and latitude to tileX and tileY in osm in iOS app(swift)

0

Hi I'm Newbie

I'm trying to make openstreetmap's tile on my iOS app(swift).

but when I try to do , like "http://tile.openstreetmap.org/7/63/42.png"

first one is zoom, second tileX, third tileY.

and I want to convert my latitude and longitude to tileX, tileY.

Surely I find https://wiki.openstreetmap.org/wiki/Slippy_map_tilenames#X_and_Y this page trying to convert

but i'm newbie in iOS(swift) so I can't do that.

So conclude, I want to know how to my latitude and longitude to tileX, tileY in "http://tile.openstreetmap.org/7/tileX/tileY.png"

if this method is wrong then what can i do for it?

thank you for reading my question.

asked 18 Oct '16, 10:44

seubseub's gravatar image

seubseub
11112
accept rate: 0%

closed 19 Oct '16, 23:30

Frederik%20Ramm's gravatar image

Frederik Ramm ♦
82.5k927201273

2

"...but i'm newbie in iOS(swift) so I can't do that." Why not? The article you linked to provides step-by-step calculations you can use to convert from latitude and longitude to the corresponding X and Y. I'm not familiar with Swift. Is it not capable of performing trigonometric operations like tan()?

(18 Oct '16, 16:49) alester

The question has been closed for the following reason “The user has access to the most in-depth wiki page with code samples to answer his question. If this does not help him, he has a general issue with programming that is out of scope here.” by Frederik Ramm 19 Oct ‘16, 23:30