Iphone google maps get address latitude and longitude

Is there any url from google maps that returns me the latitude and longitude of the address. I want to use this armor and long details in the iPhone Map set to display some information.

+2


a source to share


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


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