问题描述
我试图在iPhone上找到一个城市的长和经度。假设用户正在搜索伦敦,我会调用一些函数来检索伦敦的长和经度。我在网上看过,发现你可以使用谷歌API,但必须有苹果功能来处理这个问题吗?我已经穿过了MKReverseGeocoder,长和拉特,并告诉你你附近的城市。例如
//反向地理编码用户位置
geocoder = [[[MKReverseGeocoder alloc] initWithCoordinate: mapView.userLocation.location.coordinate] autorelease];
如果它可以逆转这个过程,那么肯定有某种形式的MKGeocoder类?
为什么必须有?因为没有。
您可以使用多种网络服务(例如Google),或者您可以下载地名数据库,例如并将其导入到您的应用中。最好将它导入到SQL数据库中,然后您可以从您的应用程序中进行搜索。
I am trying to find the long and lat of a city on the iphone. Say the user is searching for London, I would call some function that would retrieve the long and lat of London. I have looked on the web and found you can use a Google API but there must be an Apple function somewhere to handle this?
I have come accross the MKReverseGeocoder which takes the long and lat and tells you what city you are near. e.g.
// reverse geocode the user location
geocoder = [[[MKReverseGeocoder alloc] initWithCoordinate:mapView.userLocation.location.coordinate] autorelease];
If it can reverse the process there must be some form of MKGeocoder class?
Why must there be? Because there isn't.
There are a number of web services you can use (e.g. Google) or you could download a place name database such as http://www.geonames.org/ and import it into your app. It's probably best to import it into an SQL database which you can then search from your app.
这篇关于如何在iPhone上查找城市的长和经度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!