0
我只是想计算两个位置之间的距离。 在哪个用户可以输入位置的地址,并从该地址我想要计算它们之间的距离。使用iphone中的谷歌地图计算两个位置之间的距离
是否可以使用这些地址计算CLLocation的距离?
如果您有任何链接/代码,请发送给我。
请尽早帮助我。这很紧急。
在此先感谢。
我只是想计算两个位置之间的距离。 在哪个用户可以输入位置的地址,并从该地址我想要计算它们之间的距离。使用iphone中的谷歌地图计算两个位置之间的距离
是否可以使用这些地址计算CLLocation的距离?
如果您有任何链接/代码,请发送给我。
请尽早帮助我。这很紧急。
在此先感谢。
首先,您需要将地址代码到纬度/经度,然后您可以使用CLLocation框架来计算距离。 要对地址进行地址解析,可以使用forward geocoding API。
// get CLLocation fot both addresses
CLLocation *location = [[CLLocation alloc] initWithLatitude:address.latitude longitude:address.longitude];
// calculate distance between them
CLLocationDistance distance = [firstLocation distanceFromLocation:secondLocation];