From 6655f4164f5c6efef17f688c145aadfe023b6c54 Mon Sep 17 00:00:00 2001 From: Clemens Schwaighofer Date: Sun, 6 May 2018 23:17:13 +0900 Subject: [PATCH] Pre info fix for non Ascii data read check --- bin/reverse_geolocate.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/bin/reverse_geolocate.py b/bin/reverse_geolocate.py index eeee9e6..f4e3875 100755 --- a/bin/reverse_geolocate.py +++ b/bin/reverse_geolocate.py @@ -223,6 +223,9 @@ def reverseGeolocateGoogle(longitude, latitude): if response.json()['status'] == 'OK': # first entry for type = premise for entry in response.json()['results']: + # check here that in geometry the location type is "ROOFTOP" or "GEOMETRIC_CENTER" + if entry['geometry']['location_type'] == 'ROOFTOP' or entry['geometry']['location_type'] == 'GEOMETRIC_CENTER': + print("OK for {}".format(entry['geometry']['location_type'])) for sub_entry in entry: if sub_entry == 'types' and ( 'premise' in entry[sub_entry] or @@ -243,6 +246,7 @@ def reverseGeolocateGoogle(longitude, latitude): # this is an array, so we need to loop through each for addr in entry['address_components']: # in types check that index is in there and the location is not yet set + # also check that entry is NOT in japanese if index in addr['types'] and not geolocation[loc_index]: # for country code we need to use short name, else we use long name if loc_index == 'CountryCode':