The Geocoding API is a service that accepts a place as an address, latitude and longitude coordinates, or Place ID. It converts the address into latitude and longitude coordinates and a Place ID, or converts latitude and longitude coordinates or a Place ID into an address.
Why use the Geocoding API
Use the Geocoding API for website or mobile application when you want to use geocoding data within maps provided by one of the Google Maps Platform APIs. With the Geocoding API, you use addresses to place markers on a map, or convert a marker on a map to an address. This service is designed for geocoding predefined, static addresses for placement of application content on a map.
What you can do with the Geocoding API
You can use the Geocoding API to obtain geocoding data for one or more addresses or places, including the following:
- Geographic coordinates for addresses.
- Addresses for sets of latitude and longitude coordinates.
- Addresses for place IDs.
You can control where the results appear and constrain the results to a particular region, county, or postal code.
How the Geocoding API works
The Geocoding API does both geocoding and reverse geocoding:
- Geocoding: Converts addresses such as "1600 Amphitheatre Parkway, Mountain View, CA" into latitude and longitude coordinates or Place IDs. You can use these coordinates to place markers on a map, or to center or reposition the map within the view frame.
- Reverse geocoding: Converts latitude/longitude coordinates or a Place ID into a human-readable address. You can use addresses for a variety of scenarios, including deliveries or pickups.
The following table summarizes the resources available through the Geocoding API along with the data each endpoint returns.
|Data resources||Data returned||Return format|
|Geocoding||Returns address, address components, and address types. See Results in the Geocoding request and response guide.||
|Reverse geocoding||Returns address, address components, and address types. See Reverse geocoding responses in the Reverse geocoding request and response guide.|
|Place geocoding||Returns address, address components, and address types. See Reverse geocoding responses in the Place geocoding request and response guide.|
How to use the Geocoding API
|1||Get set up.||Start with Set up your Google Cloud project and complete the setup instructions that follow.|
|2||Try a geocoding request||Once you have an API key, you can start testing out the Geocoding API directly from cURL or a browser. You'll need to supply the correct lookup parameters for address or component lookups. See Geocoding parameters for details.|
|3||Try a reverse geocoding request||Supply latitude/longitude coordinates along with your API key to obtain address components for the closest human-readable address for that location. See Reverse geocoding requests for details.|
|4||Understand response basics||All endpoints in the Geocoding API return the same data in either JSON or XML. See Geocoding responses for an explanation of the data, status codes, and error messages.|
|5||Incorporate geocoding data into your own app!||You can use geocoding data to obtain addresses from map markers or to supply markers on a map based on a known address.|
Available client libraries
Call this API in the language of your choice through one of the following client libraries:
- Java Client for Google Maps Services
- Python Client for Google Maps Services
- Go Client for Google Maps Services
- Node.js Client for Google Maps Services
The Java Client, Python Client, Go Client and Node.js Client for Google Maps Services are community-supported client libraries, open sourced under the Apache 2.0 License. Download them from GitHub, where you can also find installation instructions and sample code.