remove geocode

albatross
Willem Melching 2020-04-24 13:53:46 -07:00
parent abad49110e
commit f856c99279
3 changed files with 0 additions and 144589 deletions

View File

@ -1 +0,0 @@

View File

@ -1,24 +0,0 @@
import numpy as np
import os
import csv
path = os.path.dirname(os.path.abspath(__file__))
# locally cache cities from
# https://github.com/thampiman/reverse-geocoder
csv_file_name = path + '/rg_cities1000.csv'
# right hand drive is when the steering wheel is on the right of the car
# left hand traffic is when cars driver on the left side of the road
LHT_COUNTRIES = ['AU', 'IN', 'IE', 'JP', 'MU', 'MY', 'NZ', 'UK', 'ZA']
def get_city(lat, lon):
cities = np.array(list(csv.reader(open(csv_file_name))))[1:]
positions = cities[:,:2].astype(np.float32)
idx = np.argmin(np.linalg.norm((positions - np.array([lat, lon])), axis=1))
return cities[idx]
def is_lht(lat, lon):
city = get_city(lat, lon)
country = city[-1]
return country in LHT_COUNTRIES

File diff suppressed because it is too large Load Diff