fix: handle v2 typed segments in outer_boundary field directly
NX extractor outputs typed segments in 'outer_boundary' (not 'outer_boundary_typed'). Normalize now detects dict segments and promotes them correctly.
This commit is contained in:
@@ -270,8 +270,17 @@ def normalize_geometry_schema(geometry: Dict[str, Any]) -> Dict[str, Any]:
|
||||
return out
|
||||
|
||||
out = deepcopy(geometry)
|
||||
|
||||
# v2: outer_boundary contains typed segment dicts, or outer_boundary_typed exists
|
||||
raw_outer = out.get("outer_boundary", [])
|
||||
typed_outer = out.get("outer_boundary_typed", [])
|
||||
|
||||
# Detect if outer_boundary itself contains typed segments (v2 extraction output)
|
||||
if raw_outer and isinstance(raw_outer[0], dict) and "type" in raw_outer[0]:
|
||||
typed_outer = raw_outer # outer_boundary IS the typed segments
|
||||
|
||||
if typed_outer:
|
||||
out["outer_boundary_typed"] = typed_outer
|
||||
out["outer_boundary"] = _typed_segments_to_polyline_v2(typed_outer)
|
||||
|
||||
inner_boundaries = out.get("inner_boundaries", [])
|
||||
|
||||
Reference in New Issue
Block a user