开发者

Toll Charges for Google Maps?

开发者 https://www.devze.com 2022-12-30 23:04 出处:网络
I\'m writing an a开发者_如何学Gopplication that will calculate the distance and cost between two points. One of the requirements is that I need to calculate the cost of the journey (gas and road tolls

I'm writing an a开发者_如何学Gopplication that will calculate the distance and cost between two points. One of the requirements is that I need to calculate the cost of the journey (gas and road tolls). Gas is easy. However, I can't think of a good way of doing toll charges. Google tells me if the GStep has a toll but it doesn't say how much. It seems like there is no central authority that publishes toll rates (this is for western europe). Anyone has experience dealing with this problem, and how did you solve it?

-- Pavel


There is "no" clean way to do this. We tried it a few years ago and had to go to the toll services for the rates. This is difficult to do because many toll roads (at least in the US) have varying tolls depending on how long you've traveled on the road and the rates aren't linear. In the end we used a "best guess" method of figuring them out. Some toll services provide API's to the data (REST, etc) but most just give you the data on a web page and leave you to decide whether you want to keep them updated manually or attempt to screen-scrape. We ended up just providing a link for users to let us know if toll rates change and update them manually when they do. The solution isn't ideal but still works... mostly.

0

精彩评论

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

关注公众号