I am developing an application in which I have to show the address that of the given latitude and longitude. I have latitude and longitude but I dont know how to get my address from that latitude and longitude. Any suggestion will be highly appreciated Thanks in advance!
我正在开发一个应用程序,我必须在其中显示给定纬度和经度的地址。我有纬度和经度,但我不知道如何从经度和经度中获取我的地址。任何建议将受到高度赞赏,提前谢谢!
1 个解决方案
#1
7
I have done something very similar to this recently. With the coordinates you can use MKReverseGeocoder to get the address.
我最近做了一些非常类似的事情。使用坐标,您可以使用MKReverseGeocoder获取地址。
when you find the coordinates,
当你找到坐标时,
self.reverseGeocoder =[[[MKReverseGeocoder alloc] initWithCoordinate:newLocation.coordinate]autorelease];
reverseGeocoder.delegate=self;
[reverseGeocoder start];
//called when reverseGeocoder was successfully able to retreive address
//当reverseGeocoder成功地能够检索地址时调用
- (void)reverseGeocoder:(MKReverseGeocoder *)geocoder didFindPlacemark:(MKPlacemark *)placemark{
NSString *street=[placemark.addressDictionary objectForKey:@"Street"];
//get the different address components
}
//called when reverseGeocoder was unable to retreive address
//当reverseGeocoder无法检索地址时调用
- (void)reverseGeocoder:(MKReverseGeocoder *)geocoder didFailWithError:(NSError *)error{
}
Hope this helps
希望这可以帮助
#1
7
I have done something very similar to this recently. With the coordinates you can use MKReverseGeocoder to get the address.
我最近做了一些非常类似的事情。使用坐标,您可以使用MKReverseGeocoder获取地址。
when you find the coordinates,
当你找到坐标时,
self.reverseGeocoder =[[[MKReverseGeocoder alloc] initWithCoordinate:newLocation.coordinate]autorelease];
reverseGeocoder.delegate=self;
[reverseGeocoder start];
//called when reverseGeocoder was successfully able to retreive address
//当reverseGeocoder成功地能够检索地址时调用
- (void)reverseGeocoder:(MKReverseGeocoder *)geocoder didFindPlacemark:(MKPlacemark *)placemark{
NSString *street=[placemark.addressDictionary objectForKey:@"Street"];
//get the different address components
}
//called when reverseGeocoder was unable to retreive address
//当reverseGeocoder无法检索地址时调用
- (void)reverseGeocoder:(MKReverseGeocoder *)geocoder didFailWithError:(NSError *)error{
}
Hope this helps
希望这可以帮助