Address rename detection with Accept Rename tag-edit export, hover-to-toggle snap dots, cross-layer click fix, fix county street naming (Saint, County Road, Parkway), and keep OSM ids in address downloads

This commit is contained in:
zyphlar
2026-10-21 18:14:33 -07:00
parent b44ec0341f
commit 28550984be
6 changed files with 443 additions and 98 deletions
+22 -14
View File
@@ -10,6 +10,7 @@ import re
_POST_TITLE_CORRECTIONS = [
(r'\bUs\b', 'US'), # "US 441" not "Us 441"
(r'\b(\d{1,4})([a-z])\b', lambda m: m.group(1) + m.group(2).upper()), # "CR 44A" not "CR 44a"
]
def title(s):
@@ -51,23 +52,28 @@ def getunitfromaddress(value1, feature, parent):
# @qgsfunction(args='auto', group='Custom', referenced_columns=[])
def formatstreet(value1, feature, parent):
parts = value1.split()
# Handle the special case of a street name starting with "ST"
# which is almost always "Saint __" and not "Street __"
if parts[0].upper() == "ST":
parts[0] = "Saint"
if parts[0].upper() == "ROYAL" and parts[1].upper() == "ST":
parts[0] = "Royal"
parts[1] = "Saint"
# And "CR" as a first part (County Road) vs last part (Circle)
if parts[0].upper() == "C ":
parts[0] = "County Road "
if parts[0].upper() == "CR":
parts[0] = "County Road"
if parts[0].upper() == "SR":
parts[0] = "State Road"
# A leading directional ("N ST CLAIR AVE", "W C 48") doesn't change how
# the word after it reads, so the rules below look past it.
first = 1 if len(parts) > 1 and parts[0].upper() in _DIRECTIONALS else 0
for i, part in enumerate(parts):
up = part.upper()
has_next = i + 1 < len(parts)
# "ST" starting a name and followed by more words is almost always
# "Saint __" ("ST CLAIR ST", "N ST LOUIS AVE"); elsewhere, or alone
# ("N ST"), it's "Street"
if up == "ST" and has_next and (i == first or (i == 1 and parts[0].upper() == "ROYAL")):
parts[i] = "Saint"
# "CR"/"C" before a route number is County Road ("CR 44A", "W C 48",
# "OLD C 470"); a trailing "CR" is Circle (handled by formatstreetname)
elif up in ("CR", "C") and has_next and parts[i + 1][:1].isdigit():
parts[i] = "County Road"
elif up == "SR" and i == first:
parts[i] = "State Road"
parts = map(formatstreetname, parts)
return " ".join(parts)
_DIRECTIONALS = {'N', 'S', 'E', 'W', 'NE', 'NW', 'SE', 'SW'}
# @qgsfunction(args='auto', group='Custom', referenced_columns=[])
def formatname(value1, feature, parent):
@@ -256,6 +262,8 @@ def formatstreetname(name):
return "Path"
if nameUp == "PKWY":
return "Parkway"
if nameUp == "PKY":
return "Parkway"
if nameUp == "PL":
return "Place"
if nameUp == "PLZ":