Jump to content
TNG Community
klooster

Geocode problem on Server

Recommended Posts

klooster

After update to V 13 and later 13.02  I have on my server a Geocode problem. When I try to geocode a place, error: Request denied.

Bulk Geocoding fails in certain places, see printscreen

I have exactly the same TNG configuration on my Local Host, no geocode problem there. So i Geocoded the missing places on local host, backed up and uploaded the places backup to my server. Now are all places geocoded.

 

BUT of course that is not how it should work. On my server I have the Google API installed, nothing changed there after updating.

 

ANYONE idea how to solve this ?>?>??

Schermafbeelding 2020-12-23 om 15.30.36.png

 

Share this post


Link to post
Share on other sites
klooster

SOLVED.

 

First I had to activate the Geocode APIi in the Google Console Library and then activate the Geocoding API in my Google Credentials, see printscreen.

Schermafbeelding 2020-12-26 om 12.12.08.png

 

Share this post


Link to post
Share on other sites
Ken Roy

Cees,

You might want to add your screen image above to the TNG Wiki article on Google Maps - Getting Started

It seems to be a simpler image than the one in step 3, but that might be because of a different browser or computer environment

Thanks

Share this post


Link to post
Share on other sites
klooster

I added the APIS screen image to the Wiki page Ken, see printscreen.

Schermafbeelding 2020-12-26 om 14.14.24.png

Share this post


Link to post
Share on other sites
Mark Kosinski

Hi Cees and Ken,

I started running into the "Could not be geocoded (REQUEST DENIED)" error.  I reached out to Google and they told me the Geocoding API only works with IP based restrictions, not HTTP.  They referred to this help article:

Using the Google Maps Platform
Which keys or credentials should I use for different Maps products?
Each time you use Google Maps Platform products, you must include an API key to validate your request. The Google Maps Platform is available for Android, iOS or Web apps, and via HTTP web services.

API Key:

An API key is a unique identifier that you generate using the Google Cloud Console.
Example of loading an API with a key: &key=AIzaSyBjsINSH5x39Ks6c0_CoS1yr1Mb3cB3cVo
Digital Signature:

A digital signature is generated using a cryptographic key provided to you by Google. Digital signatures are used with the Maps Static API and Street View Static API.
Restrictions:

API key restrictions are optional, but we strongly recommend you restrict all API keys for greater security.
You can add an application restriction to the API key. Once restricted, a key will only work on platforms that support that type of restriction. Four types of application restrictions are available. APIs enforcing the same restriction type can use the same restricted key.
IP addresses (individual servers) - for use with the web service APIs.
HTTP referrers (web sites) - for use with the web APIs.
Android app restriction (by package name and fingerprint) - for use with the Maps SDK for Android.
iOS app restriction (by iOS bundle identifier) - for use with the Maps SDK for iOS.
You can also add an API restriction to the API key. For more information, see Get, add, and restrict an API key.
The table below indicates the key/credential and application restriction for each Google Maps Platform API/SDK.

API/SDK	Credential & Application Restriction
Maps SDK for Android	API key with Android restriction1
Places SDK for Android	API key with Android restriction1
Maps SDK for iOS	API key with iOS restriction1
Places SDK for iOS	API key with iOS restriction1
Maps JavaScript API	API key with HTTP referer restriction1
Maps Static API	API key with HTTP referer restriction1 + Digital Signature2
Street View Static API	API key with HTTP referer restriction1 + Digital Signature2
Maps Embed API	API key with HTTP referer restriction1
Directions API	API key with IP address restriction1
Distance Matrix API	API key with IP address restriction1
Elevation API	API key with IP address restriction1
Geocoding API	API key with IP address restriction1
Geolocation API	API key with IP address restriction1
Roads API	API key with IP address restriction1
Time Zone API	API key with IP address restriction1
Places API	API key with IP address restriction1
1 API key restrictions are optional, but we strongly recommend you restrict all API keys for greater security.
2 Depending on usage, a digital signature may be required for the Maps Static API and Street View Static API. Regardless of usage, we strongly recommend that you use both an API key and a digital signature to authenticate your requests.

So the Maps Javascript API works with HTTP and Geocoding works with IP restrictions.  They are saying to make this work correctly a 2nd key with IP based restrictions is required.  I'm going to try changing my existing key from HTTP to IP and see if everything still works.  From the article above I would imagine the Maps would stop working... 

As I suspected the Maps stopped displaying in TNG when I set the Application Restriction in my Google API credentials to IP instead of HTTP.  Setting the Application Restrictions to None and leaving the API restrictions set to the API's being used appears to work.  I'm not sure how happy Google is going to be with this workaround, but for the moment it works in my case.

Google API Key Restrictions.jpg

Share this post


Link to post
Share on other sites
Michala

I was having exactly this issue having configured http restriction; I didn't know about geocoding being limited to IP restriction only - thank you @Mark Kosinski :)

From a security perspective rather than leaving it open I think we need a field to specify the API key for geocoding API which is different to the one for maps.  Anyone know if this is on the roadmap?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×