Search code examples
google-mapsmapsgoogle-geocoding-apigeocode

google-maps geocoding API no results


Can some please tell me why this call to Google geocoding API returns no results. https://maps.googleapis.com/maps/api/geocode/json?address=1226%20Freeport%20Road+Defuniak%20Springs+FL+32433


Solution

  • You can find this address using the Places API request:

    https://maps.googleapis.com/maps/api/place/textsearch/json?query=1226%20Freeport%20Road%20Defuniak%20Springs%20FL%2032433&key=YOUR_API_KEY

    Why you cannot find it with Geocoding API? If you check the response from Places API you will see the following:

    "results":[
    {
      "formatted_address":"1226 Freeport Road, Defuniak Springs, FL 32433, United States",
      "geometry":{
        "location":{
          "lat":30.7045583,"lng":-86.1251103
        }
      },
      "icon":"https://maps.gstatic.com/mapfiles/place_api/icons/restaurant-71.png",
      "id":"bcb674fa738a9af907230e17fb25014a498d7987",
      "name":"Subway",
      "opening_hours":{
        "open_now":true,
        "weekday_text":[
    
        ]
      },
      "place_id":"ChIJn1aPjK3Rk4gRL0ZTnQtbwS0",
      "price_level":1,
      "reference":"CmRRAAAAvNQhXr-Zgrhc2HdI8hECvgzuLZQfTgP1MdA0oH-db5-8SPiXOLIsKYYMYUCTEQreUdP4JwV-EBZJhttf52dUFCOBzAHF7iOrgvtEnDpe_EcoBqg6z_bPo14X9_CW9ZafEhApON7yxIXlHbhjqdz7qe37GhTWK5ifCApitBrSehqI8bIG03Z2IQ",
      "types":[
        "restaurant","food","point_of_interest","establishment"
      ]
    },....
    

    Please note that this place has types "restaurant","food", ... So it represents a business. Geocoding API filters all businesses out and works only with features that have type street address.

    You can create a street address yourself using Map Maker:

    https://mapmaker.google.com/mapmaker

    Hope it helps!