JuliaGeo / GeometryOps.jl

GeoInterface-based geometry operations
https://juliageo.org/GeometryOps.jl/
MIT License
30 stars 4 forks source link

Geometry validation methods #14

Open rafaqz opened 1 year ago

rafaqz commented 1 year ago

We need some functions like Rs sf_make_valid to validate geometry correctness. R is just using GEOS for this.

Currently we are in a wild-west situation where anything reads, writes and plots and will just randomly fail when it hits methods where validity matters.

skygering commented 1 year ago

I am just copying over a comment from code I am cleaning up that connects to this:

What to do for corner cases (nan point, etc)?

asinghvi17 commented 9 months ago

I imagine this working on several levels, and one would ascend the tree from the bottom up, from point to feature collection.

If empty geometries are deemed valid, ok - if not, then we could flag invalid and remove them.

For all geometries, antimeridian cutting is a viable method. The only issue is passing per-point attributes through for plotting - which will probably require a reimplementation in GeoMakie.

Alternatively, we could have internal functions here which return a list of the indices of altered/added vertices (perhaps when called with a Val) that GeoMakie can use to interpolate (or we can build that utility into GeometryOps which would be pretty cool). This feature is also what the barycentric API is building towards.

Feature collections - I guess validity checks are just all(isvalid.(fc.geometry))? Probably feature

https://learn.microsoft.com/en-us/sql/relational-databases/spatial/linestring?view=sql-server-ver16 is a nice link I thought