-1

I'm working with Google GeoCoding service (using a get request from the browser) and try to get the clean street name (without the pre/post direction and the suffix) for example: If my address is "3307 W Bertona St Apt 3 , Seattle , WA" I want to get just the street name "Bertona". My request url: https://maps.googleapis.com/maps/api/geocode/json?address=3307%20W%20Bertona%20St%20Apt%203%20%2C%20Seattle%20%2C%20WA%20%2C%20&sensor=false&client={clientId}&signature={PrivateKey}

Is there any way to retrieve the clean street name from the service?

Amos
  • 1

1 Answers1

0

You can retrieve the street name from address_components array in the response:

{
   "results":[
   {
        "address_components":[
        {
          "long_name":"3",
          "short_name":"3",
          "types":[
             "subpremise"
          ]
        },
        {
          "long_name":"3307",
          "short_name":"3307",
          "types":[
             "street_number"
          ]
        },
        {
           "long_name":"West Bertona Street",
           "short_name":"W Bertona St",
           "types":[
              "route"
           ]
         },

The component of type route contains the long and short street names. This is the most clean name that you can get from Geocoding API request.

xomena
  • 31,125
  • 6
  • 88
  • 117