go-geom
go-geom copied to clipboard
Method to check validity of geometries
Hey everyone. I was wondering if there is a way to check if an EWKB value was a valid geometry, much like PostGIS' ST_IsValid function
For example, I want to detect if a value I'm getting is a LINESTRING with only one point, or a polygon which is not closed
I am aware of this Unmarshal function:
geo, err := ewkb.Unmarshal(MustHexDecode("010200000001000000000000000000F03F0000000000000040"))
if err != nil {
fmt.Println("invalid geo value. ignoring:", err)
}
In a way wish there was a geo.IsValid() or some attribute which can be checked to deduce validity. Thanks !
There is currently no such function in go-geom. Contributions welcome!
You may also consider github.com/twpayne/go-geos which does have such a function.