I am using google direction API in which when i enter only name of city then it give the value of latitude and longitude of source and destination of city address. While i am enter whole address like as B-1,ridhi sidhi complex, Chopra katla,Rani bazar, Bikaner then i don't give any latitude and longitude. How i get latitude and longitude of that address from Google direction API?
Asked
Active
Viewed 584 times
1 Answers
0
NSString *urlString = [NSString stringWithFormat:@"http://maps.google.com/maps/geo?q=%@&output=csv",
[loactionTextField.text stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
NSString *locationString = [NSString stringWithContentsOfURL:[NSURL URLWithString:urlString]
encoding:NSUTF8StringEncoding
error:nil];
NSArray *array = [locationString componentsSeparatedByString:@","];
if(array == nil)
{
return;
}
else
{
if(array.count > 3)
{
lat = [[array objectAtIndex:2] doubleValue];
longt = [[array objectAtIndex:3] doubleValue];
}
}
I tried your address in this and it does return lat and long.

Robin
- 10,011
- 5
- 49
- 75