开发者

Google Maps API duration for specific route

I'm writing an iOS application and need to get the duration time for a specific route (latitude, longitude points), how can I 开发者_如何学编程do that?

Thanks


There are various methods to calculate the distance between two points given by lat/lng. The simplest is to use the functions provided by the spherical namespace of Google Maps API v3:

computeDistanceBetween(from:LatLng, to:LatLng)

There is even a method to compute the length of a path:

computeLength(path:Array.<LatLng>|MVCArray.<LatLng>)

To use these methods you would need to initialize Maps as follows:

<script type="text/javascript"
        src="http://maps.googleapis.com/maps/api/jslibraries=geometry&sensor=false"> 
</script>

And if you know the distance and the velocity, you can compute the time.


I finally found this: http://code.google.com/apis/maps/documentation/distancematrix/

Thanks to Jiri for his help!

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜