简体   繁体   English

使用ColdFusion从一系列站点到Google地图的距离

[英]Getting distance from Google Maps from a series of stops using ColdFusion

My client makes deliveries and needs to record the mileage driven between each stop as well as a total miles for the day. 我的客户进行送货,需要记录每个站点之间的行驶里程以及一天的总里程。 The route is known ahead of time. 该路线是提前知道的。 The addresses are also known so I am able to obtain the lat/long of the addresses for Google maps. 这些地址也是已知的,因此我能够获取Google地图地址的经/纬度。 I'd like to get the distance for each leg and record them in the database for end of year reporting as well as a grand total of miles driven for the year (the grand total is the easy part so that doesn't really need to be addressed). 我想获取每条腿的距离,并将其记录在数据库中以进行年终报告,以及本年度的行驶总里程数(总里程数很容易,因此实际上并不需要被解决)。

1) Is this possible with the current Google Maps API? 1)当前的Google Maps API有可能吗? I have the Google map key. 我有Google地图密钥。
2) If yes, do you have a link to a demo that I can look at? 2)如果是,您是否有我可以查看的演示的链接?

I'm coding this in ColdFusion but would be open to reverse engineering a PHP page. 我在ColdFusion中对此进行编码,但是可以对PHP页面进行反向工程。

This is possible, you have to request the directionsService . 这是可能的,您必须请求directionsService The service-response will contain the distance for each step( example ), you only need to fetch the desired data out of the response. 服务响应将包含每个步骤的距离( 示例 ),您只需要从响应中获取所需的数据即可。

Note: you may only request routes with up to 8 waypoints, when your routes include more waypoints you must split the routes. 注意:您最多只能请求带有8个航路点的路线,而当您的路线包含更多航路点时,您必须拆分路线。

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

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