Giter VIP home page Giter VIP logo

Comments (12)

tcassou avatar tcassou commented on July 28, 2024 1

Hi @ChakChak1234
Thanks for reporting, I'll have a look!

from mapsplotlib.

tcassou avatar tcassou commented on July 28, 2024 1

Hi @ChakChak1234
I found out: this happens if you have not configured your billing details (note that for personal and reasonable usage you won't pay anything, the first 300$ are free in your first year).
When disabling payment, I get the same forbidden error; when reenabling it everything works fine.

I'll fix the exception, and will add it to the README, thanks again for reporting!

from mapsplotlib.

tcassou avatar tcassou commented on July 28, 2024 1

Simple fix that works for now: allowing not to set the API key. Although I'm sure some constraints apply, and the number of requests will be limited. This is also how you side stepped the issue right? If not happy to see how you did it!
I can release an update soon.

This package can still be used of course despite the pricing change, although it will loose some of its interest if you have to start paying... Then I guess I'll take a look at Open Street Maps for example.

from mapsplotlib.

ChakChak1234 avatar ChakChak1234 commented on July 28, 2024 1

Yeah, I side-stepped the issue by not including the api_key value into the url string to call the static map.

In my case, my issue was for mplt.heatmap(), so I broke apart the function into to img, pixel portion and the plotting portion. The code for the pixel portion still works, but I wrote this to obtain the img. Nothing too fancy. I should also note that because I had to call specific functions individually, I had to import specific portions of the mapsplotlib library.

def get_img(country, zoom, size, scale, maptype):
    # url variable store url
    url  = 'https://maps.googleapis.com/maps/api/staticmap?'
    url += 'center={}&'.format(country)
    url += 'zoom={}&'.format(zoom)
    url += 'scale={}&'.format(scale)
    url += 'size={}x{}&'.format(size, size)
    url += 'maptype={}&'.format(maptype)
    
    r = requests.get(url)
    img = Image.open(StringIO((r.content)))
    
    return img

from mapsplotlib.

tcassou avatar tcassou commented on July 28, 2024 1

This is very close to what I modified in this commit, directly in the GoogleStaticMapsAPI class. I'll release an updated version in a few minutes, let me know if you still encounter issues.

from mapsplotlib.

ChakChak1234 avatar ChakChak1234 commented on July 28, 2024 1

The issue was fixed [at least until google static map api finalizes their conditions and policies]. Thanks so much!

from mapsplotlib.

ChakChak1234 avatar ChakChak1234 commented on July 28, 2024

Hey @tcassou

Thanks for the quick response. I figured that that was an important factor to issues #12 and #13, I just didn't know how to phrase it as "You need to pay."

Does this mean that the requests.get() function won't return the api_key now?

from mapsplotlib.

tcassou avatar tcassou commented on July 28, 2024

Not sure I get your question on requests.get()? The API key has to be passed to the url.

If you use an API key, it looks like your account now has to be configured with billing details (this has probably been enforced very recently, it used to be ok).
It looks like you can still call the API and get results without using the key, and I suspect this will not last for too long..!

I'll try to find more context, but there's a chance that "we have to pay" indeed... At least the first 300$ are free...

from mapsplotlib.

tcassou avatar tcassou commented on July 28, 2024

From this page it seems that the Static Maps API is not part of the free products (with quotas)...

from mapsplotlib.

ChakChak1234 avatar ChakChak1234 commented on July 28, 2024

from mapsplotlib.

tcassou avatar tcassou commented on July 28, 2024

https://pypi.org/project/mapsplotlib/1.1.2/

from mapsplotlib.

tcassou avatar tcassou commented on July 28, 2024

@ChakChak1234 does the new version work for you? Can I close this issue?
Thanks!

from mapsplotlib.

Related Issues (17)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.