python staticmap api GeocoderError: Error OVER_QUERY_LIMIT

Asked 1 years ago, Updated 1 years ago, 90 views

"We have constructed the program by referring to ""Save a map around a specific coordinate as an image using urllib"" on the site below."I rewritten html1 and html2 and put in the google api key, but it says GeocoderError: Error OVER_QUERY_LIMIT.
I have never used stack map api.
Please give me an improvement plan.
Please help me.

https://www.robotech-note.com/entry/2016/12/21/213024

Error Code

File"<ipython-input-2-e038d4def 69f>", line 1, in<module>
    runfile('/Users/name/map.py')

  File"/Users/name/anaconda3/envs/python35/lib/python3.6/site-packages/spyder_kernel/customize/spydercustomize.py", line 668, inrunfile
    execfile(filename,namespace)

  File"/Users/name/anaconda3/envs/python35/lib/python3.6/site-packages/spyder_kernel/customize/spydercustomize.py", line 108, in execfile
    exec(compile(f.read(), filename, 'exec', namespace)

  File "/Users/name/map.py", line 19, in<module>
    results=Geocoder.geocode(address)

  File"/Users/name/anaconda3/envs/python35/lib/python3.6/site-packages/pygeocoder.py", line 129, in geocode
    return GeocoderResult (Geocoder.get_data(params=params))

  File"/Users/name/anaconda3/envs/python35/lib/python3.6/site-packages/pygeocoder.py", line 212, inget_data
    raise GeocoderError(response_json['status'], response.url)

GeocoderError: Error OVER_QUERY_LIMIT
Query: https://maps.google.com/maps/api/geocode/json?address=%E5%A4%A7%E9%98%AA%E5%9F%8E&sensor=false&bounds=&region=&language=&components =

python code

from pygeocoder import Geocoder
import urllib

def download_pic(url, filename):
    img=urllib.urlopen(url)
    localfile=open("./"+str(filename)+".png", 'wb')
    localfile.write(img.read())
    img.close()
    localfile.close()

address='Osaka Castle'
results=Geocoder.geocode(address)
print(results[0].coordinates)

result=Geocoder.reverse_geocode (*results.coordinates, language="ja")
print(result)

html1="https://maps.googleapis.com/maps/api/staticmap?center=34.687315,135.526201"
html2="&maptype=hybrid&size=640x480&sensor=false&zoom=18&markers=34.687315,135.526201"
html3="&key=APIKey&signature=signaturekey"

axis=str(results[0].coordinates)[0])+", "+str(results[0].coordinates)[1])

html=html1+axis+html2+axis+html3

print(html)

download_pic (html, address)

Tried
When I checked how to use Google stack map api on Google site, I put in the signature key and set the price, so I think the conditions of use are met.Please give me some advice.

python api anaconda spyder

2022-09-30 18:29

1 Answers

https://maps.google.com/maps/api/geocode/json?address=%E5%A4%A7%E9%98%AA%E5%9F%8E&sensor=false&bounds=&region=&language=&components=

The response error messages returned when accessed at this URL are as follows:

"Keyless access to Google Maps Platform is deprecated. Please use an API key with all your API calls to void service interruption. For further details please refer to http://g.co/dev/maps-no-account"

This means that you need an API key, so read this page carefully for more information.

See http://g.co/dev/maps-no-account

There was also a Japanese blog with instructions on how to obtain an API key.It's a little old, but this page might be helpful.

https://nendeb.com/276


2022-09-30 18:29

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.