Skip to content

Doc: Add and update check-geometry examples - #15271

Open
geographika wants to merge 3 commits into
OSGeo:masterfrom
geographika:make-valid-docs
Open

geographika wants to merge 3 commits into
OSGeo:masterfrom
geographika:make-valid-docs

Conversation

@geographika

Copy link
Copy Markdown
Collaborator
  • Update gdal vector check-geometry example to use AS_WKT as using AS_XY throws errors ERROR 1: Geometry type Multi Point is not compatible with GEOMETRY=AS_XY. since gdal vector check-geometry: write error geometries as MultiPoint #13854
  • Add a couple more complex examples, checking folders of datasets and using the handy --no-create-empty-layers option
  • Various updates to attempt to clarify some notes about validity
  • OGR Simple Features standard should be OGC Simple Features standard
  • Fixes a couple of MultiPolyon/MultiPolygon typos

.. figure:: ../../images/programs/gdal_vector_check_geometry.svg

Error locations reported by :program:`gdal vector check-geometry` for Polygon, MultiPolyon, and LineString inputs.
Error locations reported by :program:`gdal vector check-geometry` for Polygon, MultiPolygon, and LineString inputs.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Odd that this got in, I wonder if the spellcheck misses figure captions.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Strange indeed, as its not in the word list. Maybe camel casing gets ignored?

- Polygons and MultiPolygons are checked for validity. A single error point will be reported even if there are multiple causes of invalidity.
- LineStrings and MultiLineStrings are checked for simplicity. All self-intersection locations will be reported if GDAL is built using version 3.14 or later of the GEOS library. With earlier versions, self-intersection locations are not reported.
- GeometryCollections are checked that their individual elements are valid / simple. A single error point will be reported even if there are multiple causes of invalidity.
- Point geometries are always considered valid/simple.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably out of scope for this PR, but GEOS considers points with NaN coordinates to be invalid. I don't know if that comes from OGR or not. GDAL doesn't bother passing points to GEOS, so in this case GDAL reports valid where GEOS reports invalid.

gdal pipeline read "POINT (3 NaN)" ! check-geometry ! write /vsistdout/ --format CSV
Warning 1: Requested to create spatial CSV layer but GEOMETRY layer creation option not set. No geometry will be output.
Warning 1: Point geometry passed to 'gdal vector check-geometry'. Point geometries are always valid/simple. Further messages of this type will be suppressed.
error

vs

geosop -a "POINT (3 NaN)" isValid
false

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know if that comes from OGR or not.

JTS does not accept "POINT (3 NaN)" either. I cannot imagine what kind of point that would be, but there are other things that I cannot imagine but which are apparently true anyhow.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This sounds like it could cause some confusion, if check-geometry returns valid for a dataset including NaN, and then extents and other calculations are messed up later? Is it worth opening an issue for this? Or I can add a note to the docs?

@dbaston dbaston added the documentation Issues and contributions to the documentation content label Sep 18, 2026
@geographika geographika added the funded through GSP Work funded through the GDAL Sponsorship Program label Sep 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Issues and contributions to the documentation content funded through GSP Work funded through the GDAL Sponsorship Program

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants