{"id":15032692,"url":"https://github.com/googlemaps/google-maps-services-java","last_synced_at":"2025-05-13T20:10:49.273Z","repository":{"id":37271605,"uuid":"22978651","full_name":"googlemaps/google-maps-services-java","owner":"googlemaps","description":"Java client library for Google Maps API Web Services","archived":false,"fork":false,"pushed_at":"2025-04-14T22:41:13.000Z","size":7349,"stargazers_count":1731,"open_issues_count":52,"forks_count":954,"subscribers_count":127,"default_branch":"main","last_synced_at":"2025-04-28T10:57:44.753Z","etag":null,"topics":["client-library","java"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/googlemaps.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":"AUTHORS","dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2014-08-15T04:35:21.000Z","updated_at":"2025-04-15T14:30:23.000Z","dependencies_parsed_at":"2023-02-19T12:45:32.820Z","dependency_job_id":"9792ccbf-65e0-475d-8e92-0efd19a01670","html_url":"https://github.com/googlemaps/google-maps-services-java","commit_stats":null,"previous_names":[],"tags_count":69,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/googlemaps%2Fgoogle-maps-services-java","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/googlemaps%2Fgoogle-maps-services-java/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/googlemaps%2Fgoogle-maps-services-java/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/googlemaps%2Fgoogle-maps-services-java/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/googlemaps","download_url":"https://codeload.github.com/googlemaps/google-maps-services-java/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254020609,"owners_count":22000754,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["client-library","java"],"created_at":"2024-09-24T20:19:08.697Z","updated_at":"2025-05-13T20:10:49.252Z","avatar_url":"https://github.com/googlemaps.png","language":"Java","readme":"# Java Client for Google Maps Services\n\n[![Build Status](https://travis-ci.org/googlemaps/google-maps-services-java.svg)](https://travis-ci.org/googlemaps/google-maps-services-java)\n[![Coverage Status](https://img.shields.io/coveralls/googlemaps/google-maps-services-java.svg)](https://coveralls.io/r/googlemaps/google-maps-services-java)\n[![Maven Central Version](http://img.shields.io/maven-central/v/com.google.maps/google-maps-services.svg)](http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22com.google.maps%22%20a%3A%22google-maps-services%22)\n[![Javadocs](https://www.javadoc.io/badge/com.google.maps/google-maps-services.svg)](https://www.javadoc.io/doc/com.google.maps/google-maps-services)\n![GitHub contributors](https://img.shields.io/github/contributors/googlemaps/google-maps-services-java?color=green)\n[![Stack Exchange questions](https://img.shields.io/stackexchange/stackoverflow/t/google-maps?color=orange\u0026label=google-maps\u0026logo=stackoverflow)](https://stackoverflow.com/questions/tagged/google-maps)\n\n\u003e [!TIP]\n\u003e 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](https://github.com/googleapis/google-cloud-java/tree/main) ([releases](https://github.com/googleapis/google-cloud-java/releases?q=maps\u0026expanded=true)).\n\u003e\n\u003e - [Address Validation API](https://github.com/googleapis/google-cloud-java/tree/main/java-maps-addressvalidation)\n\u003e - [Datasets API](https://github.com/googleapis/google-cloud-java/tree/main/java-maps-mapsplatformdatasets)\n\u003e - [Places API (New)](https://github.com/googleapis/google-cloud-java/tree/main/java-maps-places)\n\u003e - [Routes API](https://github.com/googleapis/google-cloud-java/tree/main/java-maps-routing)\n\u003e\n\u003e The new APIs will not be added to this client library.\n\n## Description\n\nUse Java? Want to [geocode][Geocoding API] something? Looking for [directions][Directions API]?\nMaybe [matrices of directions][Distance Matrix API]? This library brings the [Google Maps API Web\nServices] to your server-side Java application.\n\nThe Java Client for Google Maps Services is a Java Client library for the following Google Maps\nAPIs:\n\n- [Directions API]\n- [Distance Matrix API]\n- [Elevation API]\n- [Geocoding API]\n- [Maps Static API]\n- [Places API]\n- [Roads API]\n- [Time Zone API]\n\n## Requirements\n\n- Java 1.8 or later\n- A [Cloud project](https://developers.google.com/maps/get-started) with the relevant API(s) enabled\n- An [API key](https://developers.google.com/maps/get-started) associated with the project above\n\n### API Key Security\n\nThe Java Client for Google Maps Services is designed for use in both server and Android applications.\nIn either case, it is important to add [API key restrictions](https://developers.google.com/maps/api-security-best-practices?hl=it)\nto improve the security of your API key. Additional security measures, such as hiding your key\nfrom version control, should also be put in place to further improve the security of your API key.\n\nYou can refer to [API Security Best Practices](https://developers.google.com/maps/api-security-best-practices) to learn\nmore about this topic.\n\n\u003e [!NOTE]\n\u003e 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.\n\n## Installation\n\nYou can add the library to your project via Maven or Gradle.\n\n\u003e [!NOTE]\n\u003e Since 0.1.18 there is now a dependency on [SLF4J](https://www.slf4j.org/). 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](https://search.maven.org/#artifactdetails%7Corg.slf4j%7Cslf4j-nop%7C1.7.25%7Cjar), but there are others like [slf4j-log4j12](https://search.maven.org/#artifactdetails%7Corg.slf4j%7Cslf4j-log4j12%7C1.7.25%7Cjar) and [slf4j-jdk14](https://search.maven.org/#artifactdetails%7Corg.slf4j%7Cslf4j-jdk14%7C1.7.25%7Cjar) that will make more sense in other configurations. This will stop a warning message being emitted when you start using `google-maps-services`.\n\n### Maven\n\n```xml\n\u003cdependency\u003e\n  \u003cgroupId\u003ecom.google.maps\u003c/groupId\u003e\n  \u003cartifactId\u003egoogle-maps-services\u003c/artifactId\u003e\n  \u003cversion\u003e(insert latest version)\u003c/version\u003e\n\u003c/dependency\u003e\n\u003cdependency\u003e\n  \u003cgroupId\u003eorg.slf4j\u003c/groupId\u003e\n  \u003cartifactId\u003eslf4j-simple\u003c/artifactId\u003e\n  \u003cversion\u003e1.7.25\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n### Gradle\n\n```groovy\nrepositories {\n    mavenCentral()\n}\n\ndependencies {\n    implementation 'com.google.maps:google-maps-services:(insert latest version)'\n    implementation 'org.slf4j:slf4j-simple:1.7.25'\n}\n```\n\nYou can find the latest version at the top of this README or by [searching\nMaven Central](https://search.maven.org/#search%7Cga%7C1%7Ca%3A%22google-maps-services%22).\n\n## Documentation\n\nView the [javadoc](https://www.javadoc.io/doc/com.google.maps/google-maps-services).\n\nAdditional documentation for the included web services is available at\n\u003chttps://developers.google.com/maps/\u003e.\n\n- [Directions API]\n- [Distance Matrix API]\n- [Elevation API]\n- [Geocoding API]\n- [Maps Static API]\n- [Places API]\n- [Roads API]\n- [Time Zone API]\n\n## Usage\n\nThis example uses the [Geocoding API] with an API key:\n\n```java\nGeoApiContext context = new GeoApiContext.Builder()\n    .apiKey(\"AIza...\")\n    .build();\nGeocodingResponse response =  GeocodingApi.geocode(context,\n    \"1600 Amphitheatre Parkway Mountain View, CA 94043\").await();\nGson gson = new GsonBuilder().setPrettyPrinting().create();\nSystem.out.println(gson.toJson(response.results[0].addressComponents));\n\n// Invoke .shutdown() after your application is done making requests\ncontext.shutdown();\n```\n\n**Note:** The `GeoApiContext` is designed to be a [Singleton](https://en.wikipedia.org/wiki/Singleton_pattern)\nin your application. Please instantiate one on application startup, and continue to use it for the\nlife of your application. This will enable proper QPS enforcement across all of your requests.\n\nAt the end of the execution, call the `shutdown()` method of `GeoApiContext`,\notherwise the thread will remain instantiated in memory.\n\nFor more usage examples, check out [the tests](src/test/java/com/google/maps).\n\n## Features\n\n### Google App Engine Support\n\nTo use Google App Engine with this client library add the latest [App Engine dependency](https://mvnrepository.com/artifact/com.google.appengine/appengine-api-1.0-sdk)\nto your `build.gradle` file:\n\n```groovy\ndependencies {\n    implementation 'com.google.appengine:appengine-api-1.0-sdk:\u003clatest version\u003e'\n}\n```\n\nYou can then use this client library on Google App Engine with the following code change:\n\n```java\nnew GeoApiContext.Builder(new GaeRequestHandler.Builder())\n    .apiKey(\"AIza...\")\n    .build();\n```\n\nThe `new GaeRequestHandler.Builder()` argument to `GeoApiContext.Builder`'s `requestHandlerBuilder`\ntells the Java Client for Google Maps Services to utilise the appropriate calls for making HTTP\nrequests from Google App Engine, instead of the default [OkHttp3](https://square.github.io/okhttp/)\nbased strategy.\n\n### Rate Limiting\n\nNever sleep between requests again! By default, requests are sent at the expected rate limits for\neach web service, typically 50 queries per second for free users. If you want to speed up or slow\ndown requests, you can do that too, using `new GeoApiContext.Builder().queryRateLimit(qps).build()`.\nNote that you still need to manually handle the [delay between the initial request and successive pages](https://developers.google.com/places/web-service/search#PlaceSearchPaging) when you're paging through multiple result sets.\n\n### Retry on Failure\n\nAutomatically retry when intermittent failures occur. That is, when any of the retriable 5xx errors\nare returned from the API.\n\nTo alter or disable automatic retries, see these methods in `GeoApiContext`:\n\n- `.disableRetries()`\n- `.maxRetries()`\n- `.retryTimeout()`\n- `.setIfExceptionIsAllowedToRetry()`\n\n### POJOs\n\nNative objects for each of the API responses.\n\n### Asynchronous or synchronous -- you choose\n\nAll requests support synchronous or asynchronous calling style.\n\n```java\nGeocodingApiRequest req = GeocodingApi.newRequest(context).address(\"Sydney\");\n\n// Synchronous\ntry {\n    req.await();\n    // Handle successful request.\n} catch (Exception e) {\n    // Handle error\n}\n\nreq.awaitIgnoreError(); // No checked exception.\n\n// Async\nreq.setCallback(new PendingResult.Callback\u003cGeocodingResponse\u003e() {\n  @Override\n  public void onResult(GeocodingResponse result) {\n    // Handle successful request.\n  }\n\n  @Override\n  public void onFailure(Throwable e) {\n    // Handle error.\n  }\n});\n```\n\n## Building the Project\n\n\u003e [!NOTE]\n\u003e You will need an API key to run the tests.\n\n```bash\n# Compile and package the project\n$ ./gradlew jar\n\n# Run the tests\n$ ./gradlew test\n```\n\n## Terms\n\nThis 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](https://cloud.google.com/maps-platform/terms).\n\nThis 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.\n\n## Support\n\nThis library is offered via an open source license. It is not governed by the [Google Maps Platform Support Technical Support Services Guidelines](https://cloud.google.com/maps-platform/terms/tssg), the [SLA](https://cloud.google.com/maps-platform/terms/sla), or the [Deprecation Policy](https://cloud.google.com/maps-platform/terms) (however, any Google Maps Platform services used by the library remain subject to the Google Maps Platform Terms of Service).\n\nThis library adheres to [semantic versioning](https://semver.org/) 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.\n\nIf you find a bug, or have a feature request, please file an [issue][issues] 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](https://developers.google.com/maps/developer-community). If you'd like to contribute, please check the [Contributing guide][contrib] in the GitHub repository.\n\n[contrib]: https://github.com/googlemaps/google-maps-services-java/blob/main/CONTRIB.md\n[Directions API]: https://developers.google.com/maps/documentation/directions\n[Distance Matrix API]: https://developers.google.com/maps/documentation/distancematrix\n[Elevation API]: https://developers.google.com/maps/documentation/elevation\n[Geocoding API]: https://developers.google.com/maps/documentation/geocoding\n[Google Maps API Web Services]: https://developers.google.com/maps/apis-by-platform#web_service_apis\n[issues]: https://github.com/googlemaps/google-maps-services-java/issues\n[Maps Static API]: https://developers.google.com/maps/documentation/maps-static/\n[Places API]: https://developers.google.com/places/web-service/\n[Time Zone API]: https://developers.google.com/maps/documentation/timezone\n[Roads API]: https://developers.google.com/maps/documentation/roads\n","funding_links":[],"categories":["Java"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgooglemaps%2Fgoogle-maps-services-java","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgooglemaps%2Fgoogle-maps-services-java","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgooglemaps%2Fgoogle-maps-services-java/lists"}