问题描述
我有一个网站,根据存储在数据库中的纬度和经度坐标,显示每个项目的附近位置。
I have a website where "near locations" are shown for each item, based on the latitude and longitude coordinates stored in a database.
问题是这样计算距离是空中线路距离,与实际驾驶距离有很大差异。
Problem is that this calculated distance is the air-line distance, which differs a lot ferom the actual driving distance.
Google地图目前只有一个JavaScript API用于驱动路线,我需要它作为Web服务API直接从服务器进行调用。
Google Maps does only have a JavaScript API for driving directions by now, I need it as a web service API to make calls directly from the server.
有没有可能做到这一点?
Is there any possibility to do this?
推荐答案
Google Maps API有一个HTTP为地理编码服务,但不适用于路线。您只能通过Javascript API访问该功能。你可以破解它,但它会打破谷歌的ToS。
The Google Maps API has a HTTP service for geocoding, but not for directions. You can only access that functionality through the Javascript API. You could hack it, but it would break Google's ToS.
更多讨论。
这篇关于Google Maps API - “道路”距离2点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!