Skip to content

Commit 902ecec

Browse files
committed
GPS split: one town by two spellings is one locality (OpenStreetMap: "Ross on Wye" and "Ross-on-Wye", g4shf; "Douliu City"/"Douliu"; 3 of 665 GPS videos)
1 parent efb8336 commit 902ecec

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

‎propose_segments.py‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4087,6 +4087,16 @@ def split_gps(p, df, out_dir):
40874087
if loc is None or (add_video.get_existing_locality_row(df, *loc)[1] is None
40884088
and not _own_city(loc[0], (lat, lon), loc[2])):
40894089
locs[i] = metro_locality(lat, lon, df, fences) or loc
4090+
# one town by two spellings is one locality, the first one's: OpenStreetMap named Ross-on-Wye "Ross on Wye" at
4091+
# some readings (xnT1A-PIywU, D2G3UkS5EjU; 2026-11-19)
4092+
# (not two towns of a name in two states)
4093+
seen = []
4094+
for i, loc in enumerate(locs):
4095+
same = loc and next((x for x in seen if (_name_key(x[0]), x[2]) == (_name_key(loc[0]), loc[2])
4096+
and (x[1] == loc[1] or not x[1] or not loc[1])), None)
4097+
if loc and not same:
4098+
seen.append(loc)
4099+
locs[i] = same or loc
40904100
for i, ((t, lat, lon), loc) in enumerate(zip(track, locs)):
40914101
a = 0 if i == 0 else (track[i - 1][0] + t) / 2 # a border half way between two readings
40924102
if stretches and stretches[-1][2] == loc:

0 commit comments

Comments
 (0)