Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions siteupdate/cplusplus/classes/Waypoint/Waypoint.cpp
Original file line numberDiff line numberDiff line change
Expand Up@@ -529,6 +529,12 @@ inline void Waypoint::us_letter(DatacheckEntryList *datacheckerrors)
if (*c < 'A' || *c++ > 'B') return;
if (*c == 0 || *c == '/' || *c == '_' || *c == '(')
datacheckerrors->add(route, label, "", "", "US_LETTER", "");
// is it followed by a city abbrev?
else if (*c >= 'A' && *c++ <= 'Z'
&& *c >= 'a' && *c++ <= 'z'
&& *c >= 'a' && *c++ <= 'z'
&& *c == 0 || *c == '/' || *c == '_' || *c == '(')
datacheckerrors->add(route, label, "", "", "US_LETTER", "");
}

inline void Waypoint::visible_distance(DatacheckEntryList *datacheckerrors, char *fstr, double &vis_dist, Waypoint *&last_visible)
Expand Down
23 changes: 19 additions & 4 deletions siteupdate/python-teresco/siteupdate.py
Original file line numberDiff line numberDiff line change
Expand Up@@ -3953,22 +3953,37 @@ def run(self):

# USA-only datachecks
if usa_flag and len(w.label) >= 2:

# look for I-xx with Bus instead of BL or BS
if re.fullmatch('\*?I\-[0-9]+[EeWwCcNnSs]?[Bb][Uu][Ss].*', w.label):
datacheckerrors.append(DatacheckEntry(r,[w.label],'BUS_WITH_I'))

# look for Ixx without hyphen
c = 1 if w.label[0] == '*' else 0
if w.label[c:c+2] == "To":
c += 2;
if len(w.label) >= c+2 and w.label[c] == 'I' and w.label[c+1].isdigit():
datacheckerrors.append(DatacheckEntry(r,[w.label],'INTERSTATE_NO_HYPHEN'))

# look for USxxxA but not USxxxAlt, B/Bus/Byp
# Eric's paraphrase of Jim's original criteria
# if re.fullmatch('\*?US[0-9]+[AB].*', w.label) and not re.fullmatch('\*?US[0-9]+Alt.*|\*?US[0-9]+Bus.*|\*?US[0-9]+Byp.*', w.label):
# Instead, let's cast a narrower net
if re.fullmatch('\*?US[0-9]+[AB]|\*?US[0-9]+[AB][/_(].*', w.label):
datacheckerrors.append(DatacheckEntry(r,[w.label],'US_LETTER'))

# Instead, let's cast a narrower net (optimized for speed, just because):
try:
c = 3 if w.label[0] == '*' else 2
if w.label[c-2] == 'U' and w.label[c-1] == 'S' and w.label[c].isdigit():
while w.label[c].isdigit():
c += 1
if w.label[c] in 'AB':
c += 1
if c == len(w.label) or w.label[c] in '/_(':
datacheckerrors.append(DatacheckEntry(r,[w.label],'US_LETTER'))
# is it followed by a city abbrev?
elif w.label[c].isupper() and w.label[c+1].islower() and w.label[c+2].islower() \
and (c+3 == len(w.label) or w.label[c+3] in '/_('):
datacheckerrors.append(DatacheckEntry(r,[w.label],'US_LETTER'))
except IndexError:
pass
prev_w = w

# angle check is easier with a traditional for loop and array indices
Expand Down