Getting nearby locations
I want to get nearby cities from current location depending upon distance, e.g, cities in radius of 100km,200km etc using the gps of iphone. How can i d开发者_如何学Pythonetermine these cties as gps only gives the details of the current location.
Thanks in advance
You need to have a database of the cities in your program, with their coordinates.
You'll read the coordinates of the iphone from the GPS, and then find the x closest cities to you by simple math (see this answer for an example)
You will have to have a custom list of cities and their respective locations and work it out yourself, or potentially use something like google local api, but I don't know if you could reliably return cities through it.
精彩评论