The
Google Geocoding API now supports plus codes in addresses, and includes them in responses. This has required a big effort by the team and I'm really excited by this.
I'm going to provide some information about the API, and some caveats. As always, if you send me feedback I can work with the API team to make changes.
This is primarily about Google's
Web Services Geocoding API. I'm also going to mention the
Javascript Geocoding API, but not the Android, iOS or any other geocoding SDK yet since I haven't done any testing myself.
*Some results will not include plus codes, such as political features, or large natural features.
Converting a plus code to a location
If the address parameter is a global code, or a local code and locality, the API returns a single result, with no address components, no formatted address and no types.The location field gives the code centre:
{
"results" : [
{
"address_components" : [],
"formatted_address" : "",
"geometry" : {
"location" : {
"lat" : 47.3655625,
"lng" : 8.524812499999999
},
"location_type" : "APPROXIMATE",
"viewport" : { ... }
}
},
"place_id" : "ChIJAAAAAAAAAAARAAAAAAAAAAA",
"types" : []
}
],
"status" : "OK"
}
Converting a location to a plus code
When you do a reverse lookup to the web service API, it converts the latitude and longitude into a 10 digit plus code. This is returned outside of the results list so it did not affect existing behaviour: