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
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Change log

### 0.5.0 - 2026-08-05
- Coordinates with more than `coordinate_precision` (default seven) decimal places are now validation errors instead of a warning. Each offending feature is reported individually with its filename and feature index, and validation stops before schema checks when any are found.
- Removed `ValidationResult.warnings` and the `COORDINATE_PRECISION_WARNING` constant; the precision message is now part of `errors`/`issues`.
- Changed `allow_zero_length_lines` to default to `True`. Set it to `False` to reject collapsed `LineString` geometries.
- Confirmed there is no `_u_id != _v_id` constraint in the validator or the schemas: an edge may start and end at the same node. A self-loop with real length always passes; one collapsed to a point is governed solely by `allow_zero_length_lines`, and is reported as a geometry problem rather than a reference problem.
- Made `issues[].filename` consistent across every error: it is now always the GeoJSON filename the problem was found in (`opensidewalks.edges.geojson`), never the internal dataset key (`edges`, `zones`) or the `All` placeholder. Error text that named a dataset key now names the file too, so `Duplicate _id's found in nodes` reads `Duplicate _id's found in nodes.geojson`.
- Coordinate precision errors now tell users how to fix the data: `Reduce them to at most 7 decimal places; you can use the OSW data wizard tool to clean this up.`
- Null/NaN errors in `ext:*` properties now point at the same remedy: `... provide a valid value or remove this property. You can use the OSW data wizard tool to clean this up.`
- Added coverage confirming coordinate precision is judged on written decimal places and never on how close a value is to a shorter one. Anything with 8 or more decimal places is rejected (`48.9999999999`, `49.0000000001`, `49.00000000`); anything with 7 or fewer is accepted (`49`, `49.0`, `49.0000000`). Exponent notation is measured after normalization.

### 0.4.5 - 2026-07-21
- Added immutable `ValidationConfig` support. Users can override the 2,000-vertex limit, seven-decimal coordinate warning threshold, and zero-length line handling per validator instance. Zero-length `LineString` geometries are rejected by default and can be allowed with `allow_zero_length_lines=True`.
- Fixed [#3982](https://dev.azure.com/TDEI-UW/TDEI/_workitems/edit/3982): edge `_u_id`/`_v_id` endpoints and zone `_w_id` vertices must now exactly match their referenced node coordinates; the previous `1e-7` tolerance was removed.
Expand Down
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ result = validator.validate()
print(result.is_valid)
print(result.errors) # returns up to the first 20 high-level errors by default
print(result.issues) # detailed per-feature issues, capped to first 20 by default
print(result.warnings) # non-blocking coordinate precision warning, or an empty string

result = validator.validate(max_errors=10)
print(result.is_valid)
Expand All @@ -58,7 +57,7 @@ from python_osw_validation import OSWValidation, ValidationConfig
config = ValidationConfig(
max_geometry_vertices=3000,
coordinate_precision=8,
allow_zero_length_lines=True,
allow_zero_length_lines=False,
)

validator = OSWValidation(
Expand All @@ -71,8 +70,8 @@ result = validator.validate()
| Setting | Default | Meaning |
|---------|---------|---------|
| `max_geometry_vertices` | `2000` | Maximum allowed vertices for edges, lines, polygons, and zones. Must be an integer greater than zero. |
| `coordinate_precision` | `7` | Maximum coordinate decimal places before a non-blocking warning is reported. Must be a non-negative integer. |
| `allow_zero_length_lines` | `False` | Rejects collapsed `LineString` geometries by default. Set to `True` to allow them in edges, lines, and external line data. |
| `coordinate_precision` | `7` | Maximum coordinate decimal places allowed. Features exceeding it fail validation. Must be a non-negative integer. |
| `allow_zero_length_lines` | `True` | Allows collapsed `LineString` geometries in edges, lines, and external line data. Set to `False` to reject them. |

Allowing zero-length lines does not bypass `_u_id`/`_v_id` existence or exact
node-coordinate checks. Zero-area polygons and zones, collapsed `MultiLineString`
Expand All @@ -82,8 +81,11 @@ geometries, and line geometries in point datasets remain invalid.

- `errors`: high-level validation messages, capped by `max_errors` (default `20`).
- `issues`: detailed per-feature validation issues, also capped by `max_errors`.
- Coordinates carrying more than `coordinate_precision` decimal places fail validation before schema checks, one error per offending feature, and the message names the fix:
- `Feature 12 in 'osw.edges.geojson' contains coordinates with more than 7 decimal places. Reduce them to at most 7 decimal places; you can use the OSW data wizard tool to clean this up.`
- `issues[].filename` is always the GeoJSON file the problem was found in, never an internal dataset key.
- If actual null or numeric NaN values are found in `ext:*` extension properties, validation fails early before schema checks with actionable messages such as:
- `Invalid value at 'ext:metadata.score': nan. Null/NaN placeholders are not allowed; provide a valid value or remove this property.`
- `Invalid value at 'ext:metadata.score': nan. Null/NaN placeholders are not allowed; provide a valid value or remove this property. You can use the OSW data wizard tool to clean this up.`
- For enum validation, long allowed-value lists are summarized as:
- first 5 values joined by `|`
- followed by `| and N more` when applicable.
Expand Down
Loading
Loading