Skip to content

Unclosed Ring Polygon

vectorGeoJSONPolygonEPSG:4326tinybundled

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.

Schematic of a Polygon geometry
Schematic only -- this case's geometry could not be rendered, so the drawing is a generic Polygon, not the fixture's coordinates.
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:

pip install "geocase[all]"

View GeoCase on PyPI.

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

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

  • load
  • geometry-validation

Files

Browse this case on GitHub

Source and license

  • Source: geocase-curated
  • License: MIT

Tags

invalid parse_error polygon topology unclosed_ring vector