开发者

How get latitude and longitude of whole address?

开发者 https://www.devze.com 2023-03-30 04:02 出处:网络
I am using google direction API in which when i enter only name of city then it give thevalue of latitude and longitude of source and destination of city address. While i am enter whole address like a

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 comp开发者_如何转开发lex, 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?


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号