backdrop-contrib / geofield

Stores geographic and location data (points, lines, and polygons).
GNU General Public License v2.0
0 stars 7 forks source link

Update google map to require API key #14

Closed jenlampton closed 5 years ago

jenlampton commented 5 years ago

Since google maps now requires an API key, the geofield map sub-module should provide a settings page where this information can be provided, and use the key to render the map.

jenlampton commented 5 years ago

Oh, I can see now that if you use geocoder, that key will be used. Closing this issue.

sbgraphicdesign commented 5 years ago

I'd like to re-open this one because I'm having issues with the key from geocoder module. The only way I can make the Google API key work in order to geocode in a node from the Geofield is to set the restriction credentials in Google to accept an IP address. Unfortunately this does not work for displaying the maps, which appears to prefer a http referrer, however geocoding only works for me with an IP address. Therefore the only solution is to have two seperate API keys, one in Geocoder and one in Geofield. Anyone else experiencing this issue?

jenlampton commented 5 years ago

The only way I can make the Google API key work in order to geocode in a node from the Geofield is to set the restriction credentials in Google to accept an IP address

Hm, this sounds like a bug. Is there an open issue for this too?

Unfortunately this does not work for displaying the maps, which appears to prefer a http referrer

This also sounds like a bug... They should all definitely work all ways!

sbgraphicdesign commented 5 years ago

They're not bugs! If you want to have restriction credentials (in order to stop anyone else using your Google code) the you need to have two separate Google API keys, one for Geocoding and one for displaying the map (Javascript Map).

This is because Geocoding restriction only works with an IP Address whereas Javascript Map requires a http referrer, two different methods. Unfortunately you can only have one method per API Key.

Whilst I've got this module working on my site, I've not got any security restrictions, which is not ideal.

The solution is for Geofield to be able to use another Google API key for the map display, presumably in a similar manner to the Geocoding admin UI.