python-google-places icon indicating copy to clipboard operation
python-google-places copied to clipboard

google_places.text_search is broken or has bug that it doesn't use the passed location

Open hatem-wasfy opened this issue 6 years ago • 1 comments

This part of code used to function properly and resolve places in neat way until yesterday suddenly, all results are in USA no matter what location is passed for example Tokyo or its coordinateness.

YOUR_API_KEY = "xxxxxxxx" #valid key google_places = GooglePlaces(YOUR_API_KEY)

query_result = google_places.text_search(query="food to have pizza", location="35.6762,139.6503", radius=20000)

or

query_result = google_places.text_search(query="food to have pizza", location="tokyo", radius=20000)

or query_result = google_places.text_search(query="food to have pizza", lat_lng={'lat': 35.689487, 'lng': 139.691711}, radius=20000)

suddenly keeps returning this results in USA which is wrong!

I printed them to explain.


place_name White River Fish Market place_url https://maps.google.com/?cid=828622667071624739

place_name Sams Southern Eatery place_url https://maps.google.com/?cid=9911645007537618382

place_name Blu Fish House place_url https://maps.google.com/?cid=5497347803265962612

place_name Wichita Fish Co place_url https://maps.google.com/?cid=1122701565436120238

place_name Haysville Fish Co place_url https://maps.google.com/?cid=16912299620928506324

Is it a bug or there is a reason?

hatem-wasfy avatar Jul 18 '19 14:07 hatem-wasfy

This can be easily achieved by deleting all elements (mostly polygons) in layer 1 and 2 (default boolean layers) of your final cell. For instance:

cell_top.remove_polygons(lambda pts, layer, datatype: layer==1 or layer==2);

This still may not give you flexibility to rename all layer numbers, but probably not a big deal. The difficulty of directly "turning off" layer 1 and 2 is probably in the boolean operation of gdspy, which tends to keep the entities from different layers before the operation (if operation is on the same layer, the entities before operation do not show up in the operation result).

Johny-Leo avatar May 05 '20 13:05 Johny-Leo