views:

327

answers:

2

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 plot some information.

A: 

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.

Henrik Erlandsson
A: 

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

Ali