0
votes

I made a script calling Google Maps Geocoding API to retrieve administrative_area_level_1. It had been running fine retrieving tag for more than 90 % of addresses until December 2016. Since then, successful rate has dropped - in the API call result, there is no administrative_area_level_1 address anymore, or just sporadic.

The API call I've been using without change is in form: https://maps.googleapis.com/maps/api/geocode/json?language=cs&region=cs&address=, , , &key=

i.e.: https://maps.googleapis.com/maps/api/geocode/json?language=cs&region=cs&address=nám. W. Churchilla 1938/4, 130 67, Praha 3 - Žižkov, Česká republika&key=

Has Google made any changes? Is there any way, how to retrieve administrative_area_level_1 from Google Maps Geocoding API?

1

1 Answers

2
votes

In November 2016 Google announced a new version of forward geocoder.

In the new forward geocoder the address components array contains only information that is relevant for address formatting in the country in question.

If I understand correctly, the administrative area level 1 is not used for formatted addresses in Česká republika, so this information doesn't appear in the address components.

The only reliable method to get admin area 1 at the moment is to execute a reverse geocoding request with coordinates from your first request and with result type equal to admin area level 1.

For example,

forward geocoder for 'nám. W. Churchilla 1938/4, 130 67, Praha 3 - Žižkov, Česká republika' returns 50.083244, 14.441828

Now the reverse geocoding with result type admin area level 1:

https://maps.googleapis.com/maps/api/geocode/json?latlng=50.083244%2C14.441828&result_type=administrative_area_level_1&key=YOUR_API_KEY

returns the following result

{
  "results":[
    {
      "address_components":[
        {
          "long_name":"Prague",
          "short_name":"Prague",
          "types":[
            "administrative_area_level_1","political"
          ]
        },
        {
          "long_name":"Czechia",
          "short_name":"CZ",
          "types":[
             "country","political"
          ]
        }
      ],
      "formatted_address":"Prague, Czechia",
      "geometry":{
        "bounds":{
          "northeast":{
            "lat":50.177403,"lng":14.7067945
          },
          "southwest":{
            "lat":49.94193629999999,"lng":14.2244533
          }
        },
        "location":{
          "lat":50.0599268,"lng":14.5039935
        },
        "location_type":"APPROXIMATE",
        "viewport":{
          "northeast":{
            "lat":50.177403,"lng":14.7067945
          },
          "southwest":{
            "lat":49.94193629999999,"lng":14.2244533
          }
        }
      },
      "place_id":"ChIJi3lwCZyTC0cRIKgUZg-vAAE",
      "types":[
        "administrative_area_level_1","political"
      ]
    }
  ],
  "status":"OK"
}

UPDATE

There is also a feature request in the public issue tracker to add the administrative area level 1 in the response for Czech republic:

https://issuetracker.google.com/issues/35830929

Fell free to star the feature request to express your interest and subscribe to notifications.

UPDATE 1

Good news.

The feature request 35830929 is now marked as Fixed by Google.