简体   繁体   中英

Getting Location Address from latitude and longitude

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!

I have done something very similar to this recently. With the coordinates you can use MKReverseGeocoder to get the address.

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

- (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

- (void)reverseGeocoder:(MKReverseGeocoder *)geocoder didFailWithError:(NSError *)error{

}

Hope this helps

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM