google-maps-static-api

Google Maps Static API 403 even with API Key


I've set up a Google Maps Static API and added my API key to my code. It still comes up with an error. 403 forbidden, g.co/staticmaperror/signature

I have set the http referrer to be MYDOMAIN.COM/* and also *.MYDOMAIN.COM/*

I can't get it to stop showing a 403 error. I've only just set up the static map so it can't be a quota issue. The same code works on another client site (different domain, http referrer and API key).

I've recreated the API key and double checked it has copied and pasted correctly. I've spell checked my http referrer.

Is there any other reason I could be blocked from using the Static map API?


Solution

  • It turns out that Google Maps Static has a limit on the size of the map you can use. And this was what was causing my issue.

    You can see more information here: https://blog.dotnetframework.org/2013/09/03/exceeding-the-maximum-size-for-google-static-maps/

    It states that (you'll have to work with the below tabular data, sorry):

    **API,      scale=1,                   scale=2,             scale=4**
    
    Free,   640x640 640x640, (returns 1280×1280 pixels),    Not available.
    
    Google Maps API for Business,   2048x2048,  1024x1024 (returns 2048×2048 pixels),   512x512 (returns 2048×2048 pixels)
    

    So anything above that causes problems, which was what happened in my case.