mirror of
https://git.ianrenton.com/ian/spothole.git
synced 2026-08-06 02:21:42 +00:00
Refactor of caching & data storage part 5 #118
This commit is contained in:
@@ -16,7 +16,7 @@ class DME(LocalFileSIGRefDataProvider):
|
||||
super().__init__(self.SIG, provider_config, self.PATH)
|
||||
|
||||
def _file_to_data(self, path):
|
||||
new_data = {}
|
||||
new_data = []
|
||||
with open(path, encoding="latin-1") as _f:
|
||||
for row in csv.DictReader(_f, delimiter=";"):
|
||||
ref_id = row["COD_INE"][:5]
|
||||
@@ -25,10 +25,11 @@ class DME(LocalFileSIGRefDataProvider):
|
||||
longitude = float(row["LONGITUD_ETRS89_REGCAN95"].replace(",", ".")) if row.get(
|
||||
"LONGITUD_ETRS89_REGCAN95") else None
|
||||
|
||||
new_data[ref_id] = SIGRef(sig=self.SIG, id=ref_id,
|
||||
ref = SIGRef(sig=self.SIG, id=ref_id,
|
||||
name=row["NOMBRE_ACTUAL"] + ", " + row["PROVINCIA"],
|
||||
latitude=latitude,
|
||||
longitude=longitude)
|
||||
if latitude and longitude:
|
||||
new_data[ref_id].grid = latlong_to_locator(latitude, longitude, 6)
|
||||
ref.grid = latlong_to_locator(latitude, longitude, 6)
|
||||
new_data.append(ref)
|
||||
return new_data
|
||||
|
||||
Reference in New Issue
Block a user