m-wrzr / populartimes

MIT License
815 stars 167 forks source link

"KeyError: vicinity" #81

Closed syur16 closed 4 years ago

syur16 commented 4 years ago

Thank you for this module!

I have a question. populartimes.get(“”,[“*”],(,), (,)) is usually executed. However, depending on the range of the bounding box, an error "KeyError: vicinity" as in the figure. Can you please tell me the cause of this error, and how to resolve it? image

m-wrzr commented 4 years ago

Hey, can you provide the place id from where the error occured? Generally each place should have the vicinity / shortened address, otherwise getting the populartimes data doesn't work.

syur16 commented 4 years ago

Thank you for your reply. Sorry,I don't know exactly which facilities. When I specify the following range, I'll get a "vicinity" error. populartimes.get("api_key",["*"],(22.3185,114.160), (22.340,114.161))

m-wrzr commented 4 years ago

Seems like the result contains a whole district, which doesn't have a useable address. The error should now be resolved (if not please reopen this issue).

I'd highly suggest you add a type identifier instead of * to the request. Otherwise you process a large amount of places that probably have no use to you (like the district case above which still counts towards your quota), don't contain the populartimes data anyways and the google maps api can be very costly in some cases. Especially when the nearby endpoint has to be used and areas are very dense.