Google 地圖網路服務適用的用戶端程式庫
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
Google 地圖服務適用的 Java、Python、Go 和 Node.js 用戶端都是社群支援的用戶端程式庫,並依據阿帕契 2.0 授權的條款提供開放原始碼。您可以到 GitHub 下載這些用戶端或相關貢獻項目、查看安裝操作說明及取得程式碼範例:
使用用戶端程式庫的好處
Google 地圖服務適用的 Java 用戶端、Python 用戶端、Go 用戶端和 Node.js 用戶端,都可讓您在自家伺服器上使用 Google 地圖網路服務。這些用戶端內含下列 API 的功能:
除了這些 API 提供的功能,用戶端程式庫還能讓一些常見的工作變得更簡單一些。
- 自動頻率限制:根據預設,系統會按照各個網路服務的預期頻率限制傳送要求,但您可以使用
new GeoApiContext().setQueryRateLimit(qpm)
自訂每分鐘查詢次數上限。
- 失敗時重試:若 API 傳送
5xx
錯誤,用戶端程式庫會自動重試任何要求,並在重試時使用指數倒退演算法,這對於失敗是間斷出現的情況很有幫助。
- 輕鬆驗證:用戶端程式庫可讓您輕鬆使用 API 金鑰進行驗證。
- POJO:Java 程式庫會針對每一個 API 回應傳回原生物件,Python 程式庫則會原封不動地傳回從 API 收到的架構。
- 非同步或同步:所有的要求都支援同步或非同步呼叫樣式。
條款及細則
Google 地圖網路服務的用戶端程式庫是依阿帕契 2.0 授權的條款進行授權。
用戶端程式庫是 Google 地圖網路服務的包裝函式;Google 地圖網路服務受到《Google 地圖平台服務條款》的規範。
重要注意事項:這些程式庫不在標準 Google 廢止政策或支援協議的涵蓋範圍內。
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-08-31 (世界標準時間)。
[null,null,["上次更新時間:2025-08-31 (世界標準時間)。"],[],[],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- [Objective-C Client for Google Maps Services](https://github.com/google/google-api-objectivec-client-for-rest)\n- [Google API Client - Java Developer's Guide](/api-client-library/java/google-api-java-client/dev-guide)\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- [Directions API (Legacy)](/maps/documentation/directions)\n- [Distance Matrix API (Legacy)](/maps/documentation/distancematrix)\n- [Elevation API](/maps/documentation/elevation)\n- [Geocoding API](/maps/documentation/geocoding)\n- [Places API](/maps/documentation/places/web-service)\n- [Roads API](/maps/documentation/roads)\n- [Time Zone API](/maps/documentation/timezone)\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 API key.\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."]]