Unclosed Ring Polygon¶
A polygon where the exterior ring isn't properly closed (first coordinate ≠ last coordinate). Per GeoJSON spec (RFC 7946), a LinearRing must have four or more positions with the first and last positions being equivalent. Strict parsers will reject this entirely.
| Property | Value |
|---|---|
| Case ID | unclosed_ring_polygon |
| Category | vector |
| Format | GeoJSON |
| Geometry type | Polygon |
| CRS | EPSG:4326 |
| Location | Unplaceable -- the geometry is deliberately malformed |
| Test tier | unit |
| Size class | tiny |
| Storage class | bundled |
| Redistributable | yes |
| Loader | geopandas |
| Status | validated |
Use this case¶
import pytest
@pytest.mark.geocase_case("unclosed_ring_polygon")
def test_unclosed_ring_polygon(geocase_case) -> None:
data = geocase_case.load()
assert data is not None
Use GeoCase in your tests¶
Install the complete set of vector, raster, and NetCDF dependencies:
What this case checks¶
Expose loaders or validators that silently accept unclosed polygon rings, which can cause downstream geometry operations to fail unpredictably. Note: Many parsers (Shapely, GeoPandas) auto-close rings on load, so this primarily tests raw JSON validation or strict-mode parsers.
Risk types covered¶
geometry/parse_exceptiongeometry/ring_closuregeometry/silent_invalidgeometry/topology_error
Expected behavior¶
| Assertion | Expected |
|---|---|
expect_loadable |
no |
expect_valid_geometry |
no |
expect_crs |
yes |
expected_epsg |
4326 |
expected_geometry_types |
Polygon |
expected_error_kind |
unparseable_geometry |
Notes¶
Purpose¶
Tests handling of polygons with unclosed exterior rings (first ≠ last coordinate).
GeoJSON Specification¶
Per RFC 7946 §3.1.6:
A linear ring MUST follow the right-hand rule... The first and last positions are equivalent.
Expected Behavior¶
- Strict parsers: Should reject with ParseException
- Tolerant parsers (Shapely, GeoPandas): Auto-close the ring
- Validation functions: Should detect and report the issue
Real-World Occurrence¶
- Manual GeoJSON editing errors
- Truncated file writes
- Buggy export tools
Required capabilities¶
loadgeometry-validation
Files¶
- Primary:
geometry.geojson - Notes:
notes.md
Source and license¶
- Source: geocase-curated
- License: MIT
Tags¶
invalid parse_error polygon topology unclosed_ring vector
Related cases¶
- Self-Intersecting Polygon --
self_intersecting_polygon - Ambiguous Engine-dependent Polygon --
ambiguous_engine_dependent_polygon - Invalid Geometry at Feature 9,999 (GeoPackage) --
invalid_geometry_at_scale_gpkg - Out-of-Bounds / Invalid Coordinates --
out_of_bounds_coordinates - Disjoint Polygons --
disjoint_polygons