Problem/Motivation

location geocode gives Google geocoding returned status code: but direct query url works
APi key and gecoding enabled on location tab settings tab
log message:
Google geocoding returned status code: for the query url: https://maps.googleapis.com/maps/api/geocode/json?region=be&address=Kare...

Result when queryin gdirect url:

{
   "results" : [
      {
         "address_components" : [
            {
               "long_name" : "35",
               "short_name" : "35",
               "types" : [ "street_number" ]
            },
            {
               "long_name" : "Karel Lodewijk Ledeganckstraat",
               "short_name" : "Karel Lodewijk Ledeganckstraat",
               "types" : [ "route" ]
            },
            {
               "long_name" : "Gent",
               "short_name" : "Gent",
               "types" : [ "sublocality_level_1", "sublocality", "political" ]
            },
            {
               "long_name" : "Gent",
               "short_name" : "Gent",
               "types" : [ "locality", "political" ]
            },
            {
               "long_name" : "Oost-Vlaanderen",
               "short_name" : "OV",
               "types" : [ "administrative_area_level_2", "political" ]
            },
            {
               "long_name" : "Vlaanderen",
               "short_name" : "Vlaanderen",
               "types" : [ "administrative_area_level_1", "political" ]
            },
            {
               "long_name" : "België",
               "short_name" : "BE",
               "types" : [ "country", "political" ]
            },
            {
               "long_name" : "9000",
               "short_name" : "9000",
               "types" : [ "postal_code" ]
            }
         ],
         "formatted_address" : "Karel Lodewijk Ledeganckstraat 35, 9000 Gent, België",
         "geometry" : {
            "location" : {
               "lat" : 51.036375,
               "lng" : 3.724129
            },
            "location_type" : "ROOFTOP",
            "viewport" : {
               "northeast" : {
                  "lat" : 51.0377239802915,
                  "lng" : 3.725477980291502
               },
               "southwest" : {
                  "lat" : 51.0350260197085,
                  "lng" : 3.722780019708498
               }
            }
         },
         "place_id" : "ChIJuYqgqOJzw0cR1rPu-ZULSYY",
         "types" : [ "street_address" ]
      }
   ],
   "status" : "OK"
}

But no data saved in location field

Enabled Apis,

BigQuery API
Cloud Debugger API
Debuglet Controller API
Geocoding API
Google Cloud Logging API
Google Cloud SQL
Google Cloud Storage
Google Cloud Storage JSON API
Google Maps Geolocation API
Google Maps JavaScript API v3
Static Maps API
No restrictions on access of api key

Proposed resolution

Remaining tasks

User interface changes

none

API changes

none

Data model changes

none

Comments

ikeigenwijs created an issue.

Daniel Schaefer’s picture

I'm seeing the exact same problem. Tried with latest 3.8-beta2 and 3.x-dev.

jarodms’s picture

I had the same issue on one of my servers but it was working just fine on a different server (using Location 7.x-3.7 on BOTH servers). Other issues for the Location module pointed out that disabling IPv6 on the server fixed the problem.

I tried doing a wget of the Location query url from shell and it did not work on the broken server. I then disabled IPv6 and tried the wget again and then it did work.

Now going back to the node, I tried to Re-geocode the location and it worked fine.

Might not be suitable for everyone but it works in my case.

Umac_de’s picture

The problem is probably caused by drupal_http_request in
location/geocoding/google.inc
running in a timeout.

Using cURL HTTP Request instead solved the problem for me:
https://www.drupal.org/project/chr