HI, Does anyone know that how to convert IPHONE:37.615319,-122.388293 ( I am guessing that is the longitude and latitude of the location) in Twitter to real life location? Is there an API available ?
Thanks very much, Ling
HI, Does anyone know that how to convert IPHONE:37.615319,-122.388293 ( I am guessing that is the longitude and latitude of the location) in Twitter to real life location? Is there an API available ?
Thanks very much, Ling
If you are looking for a street address near the lat/long pair, it is called "reverse geocoding".
You may want to look at these services. http://code.google.com/apis/maps/documentation/services.html#ReverseGeocoding http://www.geonames.org/export/reverse-geocoding.html
iPhoneOS has reverse geocoding built in. See code sample below; MKPlacemark contains standard address values; see MKReverseGeocoderDelegate docs to implement the fail delegate method as well.
MKReverseGeocoder *reverseGeocoder =
[[[MKReverseGeocoder alloc] initWithCoordinate:mapView.userLocation.location.coordinate] autorelease];
reverseGeocoder.delegate = self;
[reverseGeocoder start];
...
- (void)reverseGeocoder:(MKReverseGeocoder *)geocoder didFindPlacemark:(MKPlacemark *)placemark {
NSLog(@"%@", placemark);
}
The argument is a coordinate, which means a CLLocationCoordinate2D
structure. This is declared as:
typedef struct {
CLLocationDegrees latitude;
CLLocationDegrees longitude;
} CLLocationCoordinate2D;