ThinkGeo.com    |     Blog    |     Wiki    |     Support

Google Maps error: (403) Forbidden

Hello,

We been using Thinkgeo Mapsuite Web Edition 9 for a while now and since last week we have been getting an error when trying to save an image of the map for the Google maps provider. The application has been in use for more than a year and now has started giving this error.

The error is the following:
The remote server returned an error: (403) Forbidden.

The stack trace is the following for the outer exception:
at System.Threading.Tasks.Task.WaitAll(Task[] tasks, Int32 millisecondsTimeout, CancellationToken cancellationToken)
at ThinkGeo.MapSuite.Core.GoogleMapsLayer.9z0=(RectangleShape canvasExtentForGoogleDrawing)
at ThinkGeo.MapSuite.Core.GoogleMapsLayer.9j0=(GeoCanvas canvas)
at ThinkGeo.MapSuite.Core.GoogleMapsLayer.DrawCore(GeoCanvas canvas, Collection1 labelsInAllLayers) at ThinkGeo.MapSuite.Core.Layer.Draw(GeoCanvas canvas, Collection1 labelsInAllLayers)

And the inner exception is the following for the inner exception (from the task initiated above):
at System.Net.HttpWebRequest.GetResponse()
at ThinkGeo.MapSuite.Core.GoogleMapsLayer.SendWebRequestCore(WebRequest webRequest)
at ThinkGeo.MapSuite.Core.GoogleMapsLayer.SendWebRequest(WebRequest webRequest)
at ThinkGeo.MapSuite.Core.GoogleMapsLayer./D0=(Object tileInfo)
at System.Threading.Tasks.Task.InnerInvoke()
at System.Threading.Tasks.Task.Execute()

Could someone help us understand what might be causing this.

Best Regards.

Hi Vasco,

Google did some changes last month, we discuss about it in this post: Google Overlay question

From the 403 Forbidden, it looks it’s authority problem. Could you please let us know how you use the Google layer or overlay? So we can see what’s your key type.

And you can add sending request event to get the require url, then directly access this url in browser to see what’s the detail response from Google.

Regards,

Ethan

Hello Ethan,

Thank you for the quick reply.
We’ve read the discussion you indicated and it allowed us to get to the root of the problem and solve it.
Setting the correct keys in the web.config was the solution.

Thank you,
Best Regards.

Hey Guys,
I’m having the same issue trying to use GoogleMapsLayer, googleOverlay works fine with my api key. But google static maps requires the api key and the signature. I guess the question I have is how do you supply the apikey and the signature to googlemapslayer, there is no constructor for just apikey at all that I can see.

i get the 403 but if i reference just the url in the browser i get the map from google.

TC

Hi TC,

We have this API before, but we received the email which let us know it’s not allowed so we removed it. The class only have API for “Premium Plan” now. In fact both “Standard API users” and “Premium Plan customers” have its APIKey, but API provider don’t suggest “Premium Plan customers” to use the APIKey, instead of it they ask user to use clientID and its digital signature, that’s the client id and private key in our API.

If you do want to use APIKey, please refer the share about SendingWebRequest event in forum.

Regards,

Ethan