下記のサイトの#urllibを使って特定の座標周辺の地図を画像として保存#を参考にプログラムを構築しました。。html1の方とhtml2の方を書き換え、google api key を入れたのですが、GeocoderError: Error OVER_QUERY_LIMITと表示されてしまいます。
改善策をお願いします。
https://www.robotech-note.com/entry/2016/12/21/213024
python
1from pygeocoder import Geocoder 2import urllib 3 4def download_pic(url,filename): 5 img = urllib.urlopen(url) 6 localfile = open( "./" + str(filename) + ".png" , 'wb') 7 localfile.write(img.read()) 8 img.close() 9 localfile.close() 10 11address = '大阪城' 12results = Geocoder.geocode(address) 13print(results[0].coordinates) 14 15result = Geocoder.reverse_geocode(*results.coordinates, language="ja") 16print (result) 17 18html1 = "https://maps.googleapis.com/maps/api/staticmap?center=34.687315,135.526201" 19html2 = "&maptype=hybrid&size=640x480&sensor=false&zoom=18&markers=34.687315,135.526201" 20html3 = "&key=API Key" 21 22axis = str((results[0].coordinates)[0]) + "," + str((results[0].coordinates)[1]) 23 24html = html1 + axis + html2 + axis + html3 25 26print (html) 27 28download_pic(html,address)
python
1エラーコード 2 3 4 File "<ipython-input-2-e038d4def69f>", line 1, in <module> 5 runfile('/Users/name/map.py') 6 7 File "/Users/name/anaconda3/envs/python35/lib/python3.6/site-packages/spyder_kernels/customize/spydercustomize.py", line 668, in runfile 8 execfile(filename, namespace) 9 10 File "/Users/name/anaconda3/envs/python35/lib/python3.6/site-packages/spyder_kernels/customize/spydercustomize.py", line 108, in execfile 11 exec(compile(f.read(), filename, 'exec'), namespace) 12 13 File "/Users/name/map.py", line 19, in <module> 14 results = Geocoder.geocode(address) 15 16 File "/Users/name/anaconda3/envs/python35/lib/python3.6/site-packages/pygeocoder.py", line 129, in geocode 17 return GeocoderResult(Geocoder.get_data(params=params)) 18 19 File "/Users/name/anaconda3/envs/python35/lib/python3.6/site-packages/pygeocoder.py", line 212, in get_data 20 raise GeocoderError(response_json['status'], response.url) 21 22GeocoderError: Error OVER_QUERY_LIMIT 23Query: https://maps.google.com/maps/api/geocode/json?address=%E5%A4%A7%E9%98%AA%E5%9F%8E&sensor=false&bounds=®ion=&language=&components=
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2018/12/12 02:45