Google Geocoding API not working?

Created on 22 March 2023, over 1 year ago
Updated 4 February 2024, 9 months ago

I am using Geolocation Field with Google Maps API to display a small map widget on a site. It has been working fine for a while, but today we noticed the map is just displaying blue, and is zoomed in off the coast of west Africa (you can see here https://lsnc.net/office/sacramento)

I've been playing around the various settings, and even generated a new API key to see if that was the issue. What I've noticed is that if I change the Geocoder to Photon, the map displays properly (though the Photon geocoder is not so accurate). It seems that maybe there is something going on with this module and and the Google Geocoding API. I am seeing this same behavior with both API keys that I've generated, which are actually on two separate Google accounts.

Google Geocoding API

Photon

πŸ› Bug report
Status

Closed: cannot reproduce

Version

3.12

Component

GoogleMapsAPI

Created by

πŸ‡ΊπŸ‡ΈUnited States srdtwc Skokie, IL

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @srdtwc
  • πŸ‡¨πŸ‡¦Canada 2gendevs

    Any update on this issue? We are also experiencing an issue with geolocation and it seemingly not working now. It was working.

    Our use of geolocation is within a form's autocomplete. So a user types in a location and geolocation will return with a list of results.

    For example: "Toronto" will return "Toronto, ON, Canada".

    However, for us only a few locations work (such as Toronto). It seems major population centers work, but minor ones do not. Either nothing is returned or just "Canada" is returned.

    An example: entering "London" use to return "London, ON, Canada" - now as you type "CANADA" is returned until you type the entire word "London" and then nothing is returned.

    If you get specific enough you get results. For example: "London, Ontario" returns with the expected "London, ON, Canada".

    Any idea what is going on? Why was there a shift in behavior?

  • πŸ‡¨πŸ‡¦Canada gramie

    I'm experiencing the same thing with a new installation, using an Address field. If I look at my browser's inspector, the only payload being sent to the Google Maps API is "csp_test=true", no address or other information.

    The location you see in the map is Latitude 0, Longitude 0, so basically Maps is not getting the information it needs.

    The module's installation information is:

    Machine name: geolocation_google_maps
    Version: 8.x-3.12
    Requires: GeolocationFieldjQuery UIjQuery UI AutocompletejQuery UI Menu
    Required by: Geolocation - Google Maps API - Demo (disabled)Geolocation - Google Places API (disabled)Geolocation - Google Static Maps (disabled)Geolocation - Google Static Maps - Demo (disabled)

  • πŸ‡ΊπŸ‡ΈUnited States srdtwc Skokie, IL

    Worth mentioning that we moved to the static Google Maps option since that seems to not have this problem, so the link on my original comment will not show the expected behavior.

  • πŸ‡¨πŸ‡¦Canada gramie

    Update to #3:

    If I use Photon for the Geolocation Address Formatter, it does position the marker in roughly the correct place (as you point out, not as accurately as the Google Maps API). The initial view, though, is still at 0, 0 (off the coast of Africa). I changed to rendering with Leaflet, instead of Google Maps, and the initial viewport is still wrong.

  • πŸ‡ΊπŸ‡ΈUnited States loopy1492

    Yeah, the field in the admin page doesn't display for us either. We've recently upgraded from simple_gmap 3.0.1 to dev-3.1.x if that matters.

  • Status changed to Postponed: needs info about 1 year ago
  • πŸ‡©πŸ‡ͺGermany christianadamski Berlin, Germany

    Google Geocoder works. Just installed 3.12 via simplytest.me, enabled the Demo module and checked this path: /geolocation-demo/common-map-ajax-with-address-input

    Works. So unless you come up with a better explaination / way to reproduce this, I don't know what to do..

  • πŸ‡©πŸ‡ͺGermany ikke

    Maybe I had a similar problem, the places were no longer displayed correctly on the map, instead I ended up somewhere in the sea.
    With me it was probably because Google changed something with the Apis.
    Go to:
    https://console.cloud.google.com/google/maps-apis/api-list

    Click on the project for which you created the API key. Find "Apis and Services" in the left navigation.

    There I activated all possible geo apis and then the correct addresses were found again.
    At least to pin addresses on a map correctly. Proximinity search works as well.

    Hope that helps (automatically translated into English).

    Ikke

  • πŸ‡©πŸ‡ͺGermany christianadamski Berlin, Germany
  • Status changed to Closed: cannot reproduce 9 months ago
  • πŸ‡©πŸ‡ͺGermany christianadamski Berlin, Germany
Production build 0.71.5 2024