Comments (12)
Hi @ChakChak1234
Thanks for reporting, I'll have a look!
from mapsplotlib.
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.
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.
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.
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.
The issue was fixed [at least until google static map api finalizes their conditions and policies]. Thanks so much!
from mapsplotlib.
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.
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.
From this page it seems that the Static Maps API is not part of the free products (with quotas)...
from mapsplotlib.
from mapsplotlib.
https://pypi.org/project/mapsplotlib/1.1.2/
from mapsplotlib.
@ChakChak1234 does the new version work for you? Can I close this issue?
Thanks!
from mapsplotlib.
Related Issues (17)
- AttributeError: module 'gmaps' has no attribute 'plot_markers' HOT 3
- how to know which color is which cluster? HOT 2
- Unusable Map Results HOT 3
- HTTP firbidden error HOT 5
- Integrate with GeoPandas? HOT 1
- Image positioning and zooming HOT 2
- Integrate into subplot HOT 3
- Heatmap colours are very dim HOT 2
- Polyline? HOT 3
- Allow passing API key without adding it to code (for install through pypi) HOT 1
- IOError: cannot identify image file <StringIO.StringIO instance HOT 6
- Filter out NaNs in lat/long
- Rotate map HOT 4
- Set upper limit in `get_zoom` function. HOT 3
- unable to import mapsplotlib HOT 5
- Zoom in and out HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mapsplotlib.