mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-07-01 11:32:21 +08:00
remove geocode
old-commit-hash: f856c99279df580d262d698704b91accfdc79d83
This commit is contained in:
@@ -1 +0,0 @@
|
||||
|
||||
@@ -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
|
||||
@@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:1de56dc32b0308c6094d5d833441c8ca25827f24e9a6a4cc144223ab5f9b65bf
|
||||
size 7851524
|
||||
|
Reference in New Issue
Block a user