Iphone google maps get address latitude and longitude
2 answers
This works for me:
NSString *urlString = [NSString stringWithFormat:@"http://maps.google.com/maps/geo?q=%@&output=csv",
[addressField.text stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
NSString *locationString = [NSString stringWithContentsOfURL:[NSURL URLWithString:urlString]];
luck
+5
a source to share
I don't think there is a built-in way to do reverse geocoding, but I'm new to iPhone, Objective C, Cocoa and XCode, so.
This is the best article I could find on the subject.
Goes in my "might be good" bookmark box :)
The second example url gives an XML file that you can get with initWithContentsOfURL
and then getObjectForKey:@"lat"
and getObjectForKey:@"lng"
or something along those lines.
+2
a source to share