我有起点和终点的坐标。我想计算到达终点所需的总时间。有没有谷歌地图的静态api,我会在其中传递起点和终点的坐标,作为回报,它会给出从起点1到达终点所需的总时间?
google地图静态api的示例如下所示:
https://maps.googleapis.com/maps/api/staticmap?zoom=13&size=600x300&maptype=roadmap&markers=color:red%7Clabel:C%7C<longitude>,<lat>?&key=<api key>
这将返回给定坐标的静态映射。
发布于 2017-07-05 02:13:19
为此,您必须使用Google Directions API
如果您有两个坐标,并且想知道到达某一点所需的总时间,则可以通过将坐标作为参数传递到此查询中来实现此目的。
https://maps.googleapis.com/maps/api/directions/json?origin=Toronto&destination=Montreal&key=YOUR_API_KEY
响应将是一个对象,在此对象中将有此旅程所需的所有数据,即总时间、检查点等
看一看this示例。
https://stackoverflow.com/questions/44390358
复制相似问题