MaxRev-Dev / gdal.netcore

GDAL 3.x C#/F# bindings for .NET apps
MIT License
162 stars 36 forks source link

Check Geometry Validity #93

Closed sindizzy closed 1 year ago

sindizzy commented 1 year ago

First, thank you for bringing this to GitHub. I have already incorporated your package into one of my apps. It works great and has all the functions I need.

One thing that I am looking for is determining the reasons a geometry is not valid. Currently there is the Geometry.IsValid but that's just a true/false. There's also a MakeValid which you can use to make an invalid geometry valid. Those are great but what I'm after is a CheckValid function that tells you the reasons the geometry didn't pass the grade. Something like:

  "Self-interesecting nodes"
  "Linestring must be closed"
  "Null coordinates"
  etc

Is there such a thing in GDAL/OGR?

MaxRev-Dev commented 1 year ago

As far as I know, GDAL MakeValid does not have such API. You can use NTS for this https://nettopologysuite.github.io/NetTopologySuite/api/NetTopologySuite.Operation.Valid.IsValidOp.html#NetTopologySuite_Operation_Valid_IsValidOp_ValidationError

sindizzy commented 1 year ago

Excellent. Ill give that a try. Thanks!