Một mục phía máy chủ trong kho dữ liệu GitHub của TopGit: googlemaps/google-maps-services-java, 1.8k sao, nhóm Backend, Java. Java client library for Google Maps API Web Services
Tóm tắt dựng từ metadata GitHub của chính dự án — chưa có bài review TopGit. Trang sẽ tự động cập nhật khi bài review đầy đủ được xuất bản.
VÌ SAO CHƯA CÓ REVIEW
TopGit viết bài đầy đủ cho repo có nhiều sao nhất và được yêu cầu nhiều nhất. Trang này là snapshot trong thời gian chờ — xem README gốc ở tab READ ME.
[!TIP]
If you are looking for Java client libraries for the following APIs, see the Google Maps Platform APIs in the Cloud Client Libraries for Java (releases).
Address Validation API
Datasets API
Places API (New)
Routes API
The new APIs will not be added to this client library.
Description
Use Java? Want to geocode something? Looking for directions?
Maybe matrices of directions? This library brings the Google Maps API Web
Services to your server-side Java application.
The Java Client for Google Maps Services is a Java Client library for the following Google Maps
APIs:
Directions API
Distance Matrix API
Elevation API
Geocoding API
Maps Static API
Places API
Roads API
Time Zone API
Requirements
Java 1.8 or later
A Cloud project with the relevant API(s) enabled
An API key associated with the project above
API Key Security
The Java Client for Google Maps Services is designed for use in both server and Android applications.
In either case, it is important to add API key restrictions
to improve the security of your API key. Additional security measures, such as hiding your key
from version control, should also be put in place to further improve the security of your API key.
You can refer to API Security Best Practices to learn
more about this topic.
[!NOTE]
If you are using this library on Android, ensure that your application is using at least version 0.19.0 of this library so that API key restrictions can be enforced.
Installation
You can add the library to your project via Maven or Gradle.
[!NOTE]
Since 0.1.18 there is now a dependency on SLF4J. You need to add one of the adapter dependencies that makes sense for your logging setup. In the configuration samples below we are integrating slf4j-nop, but there are others like slf4j-log4j12 and slf4j-jdk14 that will make more sense in other configurations. This will stop a warning message being emitted when you start using google-maps-services.
You can find the latest version at the top of this README or by searching
Maven Central.
Documentation
View the javadoc.
Additional documentation for the included web services is available at
https://developers.google.com/maps/.
Directions API
Distance Matrix API
Elevation API
Geocoding API
Maps Static API
Places API
Roads API
Time Zone API
Usage
This example uses the Geocoding API with an API key:
GeoApiContext context = new GeoApiContext.Builder()
.apiKey("AIza...")
.build();
GeocodingResponse response = GeocodingApi.geocode(context,
"1600 Amphitheatre Parkway Mountain View, CA 94043").await();
Gson gson = new GsonBuilder().setPrettyPrinting().create();
System.out.println(gson.toJson(response.results[0].addressComponents));
// Invoke .shutdown() after your application is done making requests
context.shutdown();
Note: The GeoApiContext is designed to be a Singleton
in your application. Please instantiate one on application startup, and continue to use it for the
life of your application. This will enable proper QPS enforcement across all of your requests.
At the end of the execution, call the shutdown() method of GeoApiContext,
otherwise the thread will remain instantiated in memory.
For more usage examples, check out the tests.
Features
Google App Engine Support
To use Google App Engine with this client library add the latest App Engine dependency
to your build.gradle file:
You can then use this client library on Google App Engine with the following code change:
new GeoApiContext.Builder(new GaeRequestHandler.Builder())
.apiKey("AIza...")
.build();
The new GaeRequestHandler.Builder() argument to GeoApiContext.Builder's requestHandlerBuilder
tells the Java Client for Google Maps Services to utilise the appropriate calls for making HTTP
requests from Google App Engine, instead of the default OkHttp3
based strategy.
Rate Limiting
Never sleep between requests again! By default, requests are sent at the expected rate limits for
each web service, typically 50 queries per second for free users. If you want to speed up or slow
down requests, you can do that too, using new GeoApiContext.Builder().queryRateLimit(qps).build().
Note that you still need to manually handle the delay between the initial request and successive pages when you're paging through multiple result sets.
Retry on Failure
Automatically retry when intermittent failures occur. That is, when any of the retriable 5xx errors
are returned from the API.
To alter or disable automatic retries, see these methods in GeoApiContext:
.disableRetries()
.maxRetries()
.retryTimeout()
.setIfExceptionIsAllowedToRetry()
POJOs
Native objects for each of the API responses.
Asynchronous or synchronous -- you choose
All requests support synchronous or asynchronous calling style.
[!NOTE]
You will need an API key to run the tests.
# Compile and package the project
$ ./gradlew jar
# Run the tests
$ ./gradlew test
Terms
This library uses Google Maps Platform services. Use of Google Maps Platform services through this library is subject to the Google Maps Platform Terms of Service.
This library is not a Google Maps Platform Core Service. Therefore, the Google Maps Platform Terms of Service (e.g. Technical Support Services, Service Level Agreements, and Deprecation Policy) do not apply to the code in this library.
Support
This library is offered via an open source license. It is not governed by the Google Maps Platform Support Technical Support Services Guidelines, the SLA, or the Deprecation Policy (however, any Google Maps Platform services used by the library remain subject to the Google Maps Platform Terms of Service).
This library adheres to semantic versioning to indicate when backwards-incompatible changes are introduced. Accordingly, while the library is in version 0.x, backwards-incompatible changes may be introduced at any time.
If you find a bug, or have a feature request, please file an issue on GitHub. If you would like to get answers to technical questions from other Google Maps Platform developers, ask through one of our developer community channels. If you'd like to contribute, please check the Contributing guide in the GitHub repository.
googlemaps/google-maps-services-java có bao nhiêu sao?
googlemaps/google-maps-services-java có 1.8k sao GitHub — tải lại trang để xem số mới nhất, hoặc xem trực tiếp github.com/googlemaps/google-maps-services-java. TopGit phản chiếu số sao của GitHub nhưng không cam kết đến từng phút.
googlemaps/google-maps-services-java có những chủ đề gì?
GitHub topics của googlemaps/google-maps-services-java: "client-library", "java". TopGit xếp repo vào nhóm Backend.
googlemaps/google-maps-services-java còn đang phát triển không?
Commit gần nhất trên googlemaps/google-maps-services-java là 6 tháng trước (theo timestamp GitHub). Repo có 970 fork — một chỉ báo về mức độ quan tâm của cộng đồng.
googlemaps/google-maps-services-java là gì?
googlemaps/google-maps-services-java (googlemaps/google-maps-services-java) là dự án Java trên GitHub. Theo mô tả gốc: Java client library for Google Maps API Web Services
googlemaps/google-maps-services-java so với các dự án Backend khác thế nào?
googlemaps/google-maps-services-java được TopGit xếp vào nhóm Backend, với 1.8k sao GitHub và viết bằng Java. Xem trang chủ đề Backend trên TopGit để so sánh với các dự án tương tự theo số sao và mức độ hoạt động.
googlemaps/google-maps-services-java viết bằng ngôn ngữ gì?
googlemaps/google-maps-services-java chủ yếu viết bằng Java. Trường "language" của GitHub dựa trên phần lớn byte ở nhánh mặc định.
Vì sao googlemaps/google-maps-services-java được xếp vào nhóm Backend?
TopGit xếp googlemaps/google-maps-services-java vào nhóm Backend dựa trên GitHub topics và mô tả của repo (gắn thẻ: "client-library", "java"). Việc phân loại dựa trên metadata thật của repo, không phải đoán theo cảm tính biên tập.
Đọc đầy đủ README ở tab phía trên.
Muốn nghe thêm một ý kiến về google-maps-services-java?
Hỏi một AI đọc được trang này — một cú bấm là có ngay nhận định về google-maps-services-java.