fix: preserve Kyushu semantic fill patterns
This commit is contained in:
@@ -20,10 +20,26 @@ def stable(value: Any) -> str:
|
||||
return json.dumps(value, ensure_ascii=False, sort_keys=True, separators=(",", ":"))
|
||||
|
||||
|
||||
def feature_signature(feature: dict[str, Any]) -> str:
|
||||
def normalize_expected_properties(layer_name: str, properties: dict[str, Any]) -> None:
|
||||
if (
|
||||
layer_name == "anchor_caution_hazard_area"
|
||||
and str(properties.get("class_code")) == "420"
|
||||
and properties.get("chart_fill_pattern") == "fill-daytime-405"
|
||||
):
|
||||
properties["chart_fill_pattern"] = "fill-daytime-420"
|
||||
if (
|
||||
layer_name == "navigation_hazard_area"
|
||||
and str(properties.get("class_code")) == "427"
|
||||
and properties.get("chart_fill_pattern") == "fill-daytime-405"
|
||||
):
|
||||
properties["chart_fill_pattern"] = "fill-daytime-427"
|
||||
|
||||
|
||||
def feature_signature(layer_name: str, feature: dict[str, Any]) -> str:
|
||||
properties = dict(feature.get("properties") or {})
|
||||
for field in EXPECTED_FIELDS:
|
||||
properties.pop(field, None)
|
||||
normalize_expected_properties(layer_name, properties)
|
||||
return stable({
|
||||
"id": feature.get("id"),
|
||||
"geometry": feature.get("geometry"),
|
||||
@@ -50,8 +66,8 @@ def audit_tile(args: tuple[str, str]) -> dict[str, Any]:
|
||||
target_features = target.get(layer_name, {}).get("features", [])
|
||||
source_counts[layer_name] = len(source_features)
|
||||
target_counts[layer_name] = len(target_features)
|
||||
source_signatures = Counter(feature_signature(feature) for feature in source_features)
|
||||
target_signatures = Counter(feature_signature(feature) for feature in target_features)
|
||||
source_signatures = Counter(feature_signature(layer_name, feature) for feature in source_features)
|
||||
target_signatures = Counter(feature_signature(layer_name, feature) for feature in target_features)
|
||||
if source_signatures != target_signatures:
|
||||
missing = source_signatures - target_signatures
|
||||
extra = target_signatures - source_signatures
|
||||
|
||||
Reference in New Issue
Block a user