Create new project design plans
This commit is contained in:
+33
-1
@@ -133,6 +133,35 @@ def process_address_fields(gdf, exceptions):
|
||||
]
|
||||
break
|
||||
|
||||
# Postal community (USPS mailing city) and city/jurisdiction (legal
|
||||
# municipal boundary) are tracked separately from addr:city above -
|
||||
# they're often the same value, but not always (e.g. a parcel legally
|
||||
# inside Leesburg or Sumterville whose mail is addressed to "The
|
||||
# Villages"). Kept for the City Boundaries report; addr:city above is
|
||||
# still the single value actually used for the OSM import itself.
|
||||
for field in ['POST_COMM', 'PostalCity']:
|
||||
if field in processed.columns:
|
||||
mapping['county_postal_community'] = [
|
||||
qgis_functions.title(str(v)) if pd.notna(v) else None
|
||||
for v in processed[field]
|
||||
]
|
||||
break
|
||||
|
||||
def _clean_jurisdiction(v):
|
||||
if pd.isna(v):
|
||||
return None
|
||||
s = str(v).strip()
|
||||
if s.upper().startswith('UNINCORPORATED '):
|
||||
s = s[len('UNINCORPORATED '):]
|
||||
elif s.upper() == 'UNINCORPORATED':
|
||||
return None
|
||||
return qgis_functions.title(s) if s else None
|
||||
|
||||
for field in ['CITY', 'Jurisdicti']:
|
||||
if field in processed.columns:
|
||||
mapping['county_city'] = [_clean_jurisdiction(v) for v in processed[field]]
|
||||
break
|
||||
|
||||
# Apply street name exceptions (some are scoped to a specific city)
|
||||
if 'addr:street' in mapping and exceptions:
|
||||
mapping['addr:street'] = apply_street_exceptions(
|
||||
@@ -201,7 +230,10 @@ def convert(zip_path, output_path):
|
||||
gdf = gdf[gdf['addr:housenumber'].notna()].copy()
|
||||
|
||||
osm_fields = ['addr:housenumber', 'addr:unit', 'addr:street',
|
||||
'addr:city', 'addr:postcode', 'addr:state']
|
||||
'addr:city', 'addr:postcode', 'addr:state',
|
||||
# Not real OSM tags - carried through for the City
|
||||
# Boundaries report only, not part of the OSM import.
|
||||
'county_postal_community', 'county_city']
|
||||
keep = [f for f in osm_fields if f in gdf.columns]
|
||||
gdf = gdf[keep + ['geometry']]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user