简体   繁体   English

在2个地点之间的道路上获取距离

[英]getting distance on roads between 2 locations

Hello how can an iphone user find the distance on roads between two locations using an in app solution preferably using two text fields? 您好,iPhone用户如何使用应用内解决方案(最好是使用两个文本字段)找到两个位置之间道路上的距离?

I tried google maps. 我尝试了谷歌地图。 However, I'm not sure if there is a mapkit tool to do this build in or a google maps api? 但是,我不确定是否有Mapkit工具可用于构建此版本或使用Google Maps API?

I am trying to use this value in order to do some calculations afterwards. 我试图使用此值以便以后进行一些计算。

The way I did it was to get the two locations and call the mapquest API to calculate the distance. 我这样做的方法是获取两个位置并调用mapquest API以计算距离。

Read here: http://developer.mapquest.com/web/products/dev-services/directions-ws 在这里阅读: http : //developer.mapquest.com/web/products/dev-services/directions-ws

My API URL is something like this: 我的API URL是这样的:

http://www.mapquestapi.com/directions/v1/routematrix?allToAll=false&ambiguities=ignore&inFormat=xml&outFormat=xml&xml=<route><locations><location>location_one</location><location>location_two</location></locations></route>&key=your_key

Then you parse the XML and get the answer! 然后,您解析XML并获得答案!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM