适用于 Google 地图网络服务的客户端库
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
适用于 Google 地图服务的 Java 客户端、Python 客户端、Go 客户端和 Node.js 客户端是由社区提供支持的客户端库,并且根据 Apache 2.0 许可开放源代码。您可以在 GitHub 下载这些客户端库、贡献代码并查找安装说明和示例代码:
为何要使用客户端库?
借助适用于 Google 地图服务的 Java 客户端、Python 客户端、Go 客户端和 Node.js 客户端,您可以在自己的服务器上使用 Google 地图网络服务。这些客户端库封装了以下 API 的功能:
除了这些 API 提供的功能外,客户端库还能略微简化一些常见任务。
- 自动速率限制:默认情况下,按照各网络服务的预期速率限制发送请求。您可以通过
new GeoApiContext().setQueryRateLimit(qps)
提供自定义 QPS 限制。
- 失败时重试:客户端库将在 API 发送
5xx
错误时自动重试任何请求。重试使用指数退避,这有助于解决间歇性故障。
- 轻松进行身份验证:利用客户端库,您可以使用免费提供的 API 密钥轻松进行身份验证。Google Maps Platform 专业版方案客户可以使用其客户端 ID 和密钥进行身份验证。
- POJO:Java 客户端库将针对每个 API 响应返回原生对象。Python 客户端库将从 API 收到的结构原样返回。
- 异步或同步:所有请求都支持同步或异步调用样式。
条款及条件
适用于 Google 地图网络服务的客户端库已获得 Apache 2.0 许可。
客户端库是 Google 地图网络服务的封装容器。使用 Google 地图网络服务时,需遵守 Google Maps Platform 服务条款。
重要提示:这些客户端库不在标准 Google 弃用政策或支持协议的涵盖范围内。
API 密钥和客户端 ID
每项 Google 地图网络服务都需要 API 密钥或客户端 ID。如需了解何时使用 API 密钥、何时使用客户端 ID,以及如何获取 API 密钥或客户端 ID,请参阅您正在使用的 API 对应的身份验证指南:
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2023-09-14。
[null,null,["最后更新时间 (UTC):2023-09-14。"],[[["\u003cp\u003eCommunity-supported client libraries for Google Maps Services are available in Java, Python, Go, and Node.js, offering convenient access to various Google Maps APIs like Directions, Geocoding, and Places.\u003c/p\u003e\n"],["\u003cp\u003eThese open-source libraries, under the Apache 2.0 License, provide features such as automatic rate limiting, retry on failure, easy authentication, and support for both synchronous and asynchronous calls.\u003c/p\u003e\n"],["\u003cp\u003eThey are governed by the Google Maps Platform Terms of Service but are not covered by the standard Google deprecation policy or support agreement.\u003c/p\u003e\n"],["\u003cp\u003eEach Google Maps web service requires an API key or client ID for authentication, and specific guides are available for obtaining and using them for each API.\u003c/p\u003e\n"]]],[],null,["# Client Libraries for Google Maps Web Services\n\nThe Java Client, Python Client, Go Client and\nNode.js Client for Google Maps Services are community supported client libraries, open sourced under the\n[Apache 2.0 License](http://www.apache.org/licenses/LICENSE-2.0). They are\navailable for download and contributions on GitHub, where you will also find installation\ninstructions and sample code: \n\n- [Java Client for Google Maps Services](https://github.com/googlemaps/google-maps-services-java)\n- [Python Client for Google Maps Services](https://github.com/googlemaps/google-maps-services-python)\n- [Go Client for Google Maps Services](https://github.com/googlemaps/google-maps-services-go)\n- [Node.js Client for Google Maps Services](https://github.com/googlemaps/google-maps-services-js)\n\nWhy use the client libraries?\n-----------------------------\n\nThe Java Client, Python Client, Go Client\nand Node.js Client for Google Maps Services enable you to work with Google Maps web services on your server.\nThey wrap the functionality of the following APIs:\n\n- [Address Validation API](/maps/documentation/address-validation/overview)\n- [Directions API (Legacy)](/maps/documentation/directions/start)\n- [Distance Matrix API (Legacy)](/maps/documentation/distancematrix/start)\n- [Elevation API](/maps/documentation/elevation/start)\n- [Geocoding API](/maps/documentation/geocoding/start)\n- [Places API](/maps/documentation/places/web-service/overview)\n- [Roads API](/maps/documentation/roads/overview)\n- [Time Zone API](/maps/documentation/timezone/start)\n\nIn addition to the functionality provided by these APIs, the client libraries\nmake some common tasks a little easier.\n\n- **Automatic Rate Limiting** By default, requests are sent at the expected rate limit for each web service. You can provide custom QPM limits with `new GeoApiContext().setQueryRateLimit(qpm)`.\n- **Retry on Failure** The client libraries will automatically retry any request if the API sends a `5xx` error. Retries use exponential back-off, which helps in the event of intermittent failures.\n- **Easy Authentication** The client libraries make it easy to authenticate with your freely available API Key. [Google Maps Platform Premium Plan](/maps/premium) customers can use their [client ID and secret](/maps/premium/overview#client-id).\n- **POJOs** The Java libraries return native objects for each of the API responses. The Python libraries return the structure as it is received from the API.\n- **Asynchronous or synchronous** All requests support synchronous or asynchronous calling style.\n\nTerms and conditions\n--------------------\n\nThe client libraries for the Google Maps web services are licensed under the\n[Apache 2.0 License](http://www.apache.org/licenses/LICENSE-2.0).\n\nThe client libraries are wrappers for the Google Maps web services. The Google Maps\nweb services are governed by the [Google Maps Platform Terms of Service](https://cloud.google.com/maps-platform/terms).\n\n**Important** : These libraries are **not covered**\nby the standard Google deprecation policy or support agreement.\n\nAPI keys and client IDs\n-----------------------\n\nEach Google Maps web service requires an API key or client ID. For a guide on\nwhen to use an API key, when to use a client ID, and how to get hold of your\nAPI key or client ID, see the authentication guide for the API you're using:\n\n- [Address Validation API](/maps/documentation/address-validation/get-api-key)\n- [Directions API (Legacy)](/maps/documentation/directions/get-api-key)\n- [Distance Matrix API (Legacy)](/maps/documentation/distancematrix/get-api-key)\n- [Elevation API](/maps/documentation/elevation/get-api-key)\n- [Geocoding API](/maps/documentation/geocoding/get-api-key)\n- [Places API](/maps/documentation/places/web-service/get-api-key)\n- [Roads API](/maps/documentation/roads/get-api-key)\n- [Time Zone API](/maps/documentation/timezone/get-api-key)"]]