Getting a city from Google Maps Api geocoding results

I use the Google Maps API ( https://maps.googleapis.com/maps/api/geocode/xml ) to geocode places and addresses. However, the results seem inconsistent. Administrative_resource_level_2 and location OR terrain and sublocality_level_1 seem to overlap. But, depending on the address, the overlap is different. One of the things I need to do is define a city. The documentation states that the area is the equivalent of a city depending on the country.

If I geocode "North Holland, the Netherlands", which is a province, I get:

  • Country: Nederland
  • administrator_area_level_1: Noord-Holland

I understand. Everything seems good ...

If I geocode Amsterdam, North Holland, Netherlands, I get the following result:

  • country: Nederland
  • administrator_area_level_1: Noord-Holland
  • administrative_area_level_2: Amsterdam
  • Location: Amsterdam

Here I start to not understand the result. Why is Amsterdam listed as administrator_area_level_2, as well as the locality? Maybe there is a higher state body with the same name? But well, Amsterdam is a locality, thus a city. What is right.

If I geocode "Anton de Complain 150, 1102 CW Amsterdam, Noord-Holland, Nederland", I get the following results:

  • Country: Nederland
  • administrative_area_level_1: North Holland
  • administrative_area_level_2: Amsterdam
  • Location: Amsterdam-Zuidoost
  • sublocality_level_1: Amsterdam-Zuidoost

Now I really don't get it.

  • Amsterdam Zwidost is mentioned here twice.
  • "-"? ... , "" - "-" - sublocality_level_1.

- , ?

+4
1

, , , Google.

:

", -, "

https://maps.googleapis.com/maps/api/geocode/json?address=Amsterdam%2C%20Noord-Holland%2C%20Nederland&key=MY_API_KEY

"address_components":[
    {
      "long_name":"Amsterdam",
      "short_name":"Amsterdam",
      "types":[
        "locality","political"
      ]
    },
    {
      "long_name":"Government of Amsterdam",
      "short_name":"Government of Amsterdam",
      "types":[
        "administrative_area_level_2","political"
      ]
    },
    {
      "long_name":"North Holland",
      "short_name":"NH",
      "types":[
        "administrative_area_level_1","political"
      ]
    },
    {
      "long_name":"Netherlands",
      "short_name":"NL",
      "types":[
        "country","political"
      ]
    }
  ]

, administrator_area_level_2 " ". , .

https://maps.googleapis.com/maps/api/geocode/json?address=Amsterdam%2C%20Noord-Holland%2C%20Nederland&language=nl&key=MY_API_KEY

:

{
    "long_name":"Amsterdam",
    "short_name":"Amsterdam",
    "types":[
      "locality","political"
    ]
},
{
    "long_name":"Amsterdam",
    "short_name":"Amsterdam",
    "types":[
      "administrative_area_level_2","political"
    ]
}

, , , " " "" . . , 2:

https://www.google.com/maps/place/Government+of+Amsterdam,+Amsterdam,+Netherlands/@52.3544136,4.7585038,11z/data=!3m1!4b1!4m5!3m4!1s0x47c63fb5949a7755:0xe4f20c148755745!8m2!3d52.3666969!4d4.8945398

.

https://maps.googleapis.com/maps/api/geocode/json?address=Anton%20de%20Komplein%20150%2C%201102%20CW%20Amsterdam%2C%20Noord-Holland%2C%20Nederland&key=MY_API_KEY

, , , . , , 2- , , , "Regering van Amsterdam" on Google.

. , Amsterdam-Zuidoost Google. , , :

enter image description here

https://www.google.com/maps/place/Amsterdam-Zuidoost,+Netherlands/@52.2569773,4.995519,12z/data=!4m5!3m4!1s0x47c60c069aab8879:0x249b64218cad1744!8m2!3d52.3079989!4d4.9715451

, Geocoder, , :

https://google-developers.appspot.com/maps/documentation/utils/geocoder/#place_id%3DChIJeYirmgYMxkcRRBetjCFkmyQ

, - ChIJeYirmgYMxkcRRBetjCFkmyQ. , Google.

Google Google :

https://support.google.com/maps/answer/3094045?hl=en&ref_topic=3093612

, !

+5

Source: https://habr.com/ru/post/1689522/


All Articles