Search code examples
google-mapsgoogle-places-api

Google place details street numbers with letters


When I do search in google's autocomplete I see correct address. Example:

Pavlichenko Street, 20b, Bila Tserkva, Kyiv Oblast, Ukraine

This address has place_id: EjtQYXZsaWNoZW5rbyBTdHJlZXQsIDIwYiwgQmlsYSBUc2Vya3ZhLCBLeWl2IE9ibGFzdCwgVWtyYWluZSIwEi4KFAoSCVcssl0EQtNAEeDmEfl02RgXEBQqFAoSCVGxb54DQtNAEbhYfU4LYvbk

I need to get a street number which is "20b". To do so I use Place Details API: https://maps.googleapis.com/maps/api/place/details/json?placeid=EjtQYXZsaWNoZW5rbyBTdHJlZXQsIDIwYiwgQmlsYSBUc2Vya3ZhLCBLeWl2IE9ibGFzdCwgVWtyYWluZSIwEi4KFAoSCVcssl0EQtNAEeDmEfl02RgXEBQqFAoSCVGxb54DQtNAEbhYfU4LYvbk&key=MY_KEY

And here what is in response:

      "address_components" : [
         {
            "long_name" : "20",
            "short_name" : "20",
            "types" : [ "street_number" ]
         },
         {
            "long_name" : "Pavlichenko Street",
            "short_name" : "Pavlichenko Street",
            "types" : [ "route" ]
         },
         {
            "long_name" : "Bila Tserkva",
            "short_name" : "Bila Tserkva",
            "types" : [ "locality", "political" ]
...

But "20" is actually different house, I need "20b". Same happens to all streets with letters. Is there way to solve this problem? Thank you


Solution

  • The long place ID EjtQYXZsaWNoZW5rbyBTdHJlZXQsIDIwYiwgQmlsYSBUc2Vya3ZhLCBLeWl2IE9ibGFzdCwgVWtyYWluZSIwEi4KFAoSCVcssl0EQtNAEeDmEfl02RgXEBQqFAoSCVGxb54DQtNAEbhYfU4LYvbk indicates that this address is not present in Google database. They try to interpolate it to the best known position that matches your search.

    Note that the existing in database addresses have a short place IDs, something like ChIJNSfioSOjpBIRSwaYW7O3LJY.

    Your prediction has a following type

     "types":[
        "route","geocode"
      ]
    

    So it looks like Google could resolve it to route level, but not to street address level.

    I can suggest reporting a missing address to Google data team as explained in the documentation

    https://support.google.com/maps/answer/3094088

    I hope this addresses your doubt.