iphone google maps get latitude and longitude of an address
Is there any URL from google maps, that returns me the latitude and longitude of an address. i want to use these lat and long details in iPhone Map kit to p开发者_运维百科lot some information.
This is working 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]];
good luck
I don't think there's a built in way to do reverse reverse geocoding, but I'm new to the iPhone, Objective C, Cocoa and XCode, so.
This is the best article I could find on the subject.
Goes in my 'could be good' bookmark drawer :)
The second example URL gives an XML file that you could fetch with initWithContentsOfURL
, and then getObjectForKey:@"lat"
and getObjectForKey:@"lng"
or something along those lines.
精彩评论