ios - 同时对 2 个或多个位置进行地理编码
<p><p>我正在尝试从多个地址字符串中获取位置。</p>
<p>我在下面的代码中使用了单个字符串。 </p>
<pre><code>NSString *addressStr = @"Neeru'sEmporio,RoadNumber36,Venkatagiri,Hyderabad,AndhraPradesh,India";//String after removing spaces
[ geocodeAddressString:orgin completionHandler:^(NSArray *placemarks, NSError *error)
{
if(!error)
{
CLPlacemark *placemark = ;
NSLog(@"%f",placemark.location.coordinate.latitude);
NSLog(@"%f",placemark.location.coordinate.longitude);
NSLog(@"%@",]);
}
else
{
NSLog(@"There was a forward geocoding error\n%@",);
}
}
];
</code></pre>
<p>如何一次从多个地址字符串中获取两个或多个位置。即,希望每个单独的字符串都有单独的 lat long,并且在获得所有位置后,我需要运行一些其他代码。</p>
<p>请帮忙。提前致谢。</p></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p>改用这个
<a href="https://maps.googleapis.com/maps/api/geocode/json?address=%@&key=%@" rel="noreferrer noopener nofollow">https://maps.googleapis.com/maps/api/geocode/json?address=%@&key=%@</a> </p>
<p>将地址作为 <code>esc_add</code> 并使用 <a href="https://developers.google.com/maps/documentation/geocoding/intro" rel="noreferrer noopener nofollow">The Google Maps Geocoding API</a> 创建一个 google apikey </p>
<p>还有一件事将所有空格“”替换为“+”</p>
<p>示例 <a href="https://maps.googleapis.com/maps/api/geocode/json?address=Neeru" rel="noreferrer noopener nofollow">https://maps.googleapis.com/maps/api/geocode/json?address=Neeru</a> 's+Emporio,Road+Number+36,Venkatagiri,Hyderabad,Andhra+Pradesh,India&key=YOUR_API_KEY</p>
<p>它会正常工作</p></p>
<p style="font-size: 20px;">关于ios - 同时对 2 个或多个位置进行地理编码,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/35266847/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/35266847/
</a>
</p>
页:
[1]