gpt4 book ai didi

ios - 同时对 2 个或更多位置进行地理编码

转载 作者:塔克拉玛干 更新时间:2023-11-02 19:54:44 26 4
gpt4 key购买 nike

我正在尝试从多个地址字符串中获取位置。

我在下面的代码中使用了单个字符串。

NSString *addressStr = @"Neeru'sEmporio,RoadNumber36,Venkatagiri,Hyderabad,AndhraPradesh,India";  //String after removing spaces

[[CLGeocoder new] geocodeAddressString:orgin completionHandler:^(NSArray *placemarks, NSError *error)
{
if(!error)
{
CLPlacemark *placemark = [placemarks objectAtIndex:0];
NSLog(@"%f",placemark.location.coordinate.latitude);
NSLog(@"%f",placemark.location.coordinate.longitude);
NSLog(@"%@",[NSString stringWithFormat:@"%@",[placemark description]]);
}
else
{
NSLog(@"There was a forward geocoding error\n%@",[error localizedDescription]);
}
}
];

如何一次从多个地址字符串中获取两个或多个位置。即,希望每个单独的字符串都有单独的经纬度,并且在获得所有位置后我需要运行一些其他代码。

请帮忙。提前致谢。

最佳答案

改用这个 https://maps.googleapis.com/maps/api/geocode/json?address=%@&key=%@

将地址作为 esc_add 传递并使用 The Google Maps Geocoding API 创建一个 google api key

还有一件事用“+”替换所有空格“”

示例 https://maps.googleapis.com/maps/api/geocode/json?address=Neeru 's+Emporio,Road+Number+36,Venkatagiri,Hyderabad,Andhra+Pradesh,India&key=YOUR_API_KEY

它会很好地工作

关于ios - 同时对 2 个或更多位置进行地理编码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35266847/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com