如何免费使用 google 路线 api

How to use google directions api for free

我使用的是 Google 路线 Api,每天 2500 次路线查询是免费的。它工作正常。现在无处不在,它在请求 api 时给出了这个错误,当它清楚地写在 https://developers.google.com/maps/documentation/directions/start 中时 该客户 ID 用于高级计划。

已下载 URL:{ "error_message" : "You must enable Billing on the Google Cloud Projectassociated to this client ID, at https://console.cloud.google.com/project/_/billing/enable.Learn more at https://developers.google.com/maps/premium/new-plan-migration", "routes" : [], "status" : "REQUEST_DENIED"} 后台任务数据 { "error_message" : "You must enable Billing on the Google Cloud Projectassociated to this client ID, at https://console.cloud.google.com/project/_/billing/enable.Learn more at https://developers.google.com/maps/premium/new-plan-migration", "routes" : [], "status" : "REQUEST_DENIED"}

我该如何解决这个问题

来自 google 地图文档:

Reminder: To use the Directions API, you must include an API key with all API requests and you must enable billing on each of your projects.

我知道他们过去允许在没有密钥或启用计费的情况下使用 API,但他们不久前更改了政策。

如果您愿意使用 google 地图的替代方案,您可以查看 OSRM(开源路由机),这是完全免费的,但需要一些设置,并且您必须自己托管。我们使用 OSRM 获取方向,并以 google 地图成本的一小部分获得更好的性能托管。