Open rafaqz opened 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)?
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.
[ ] A point is valid if it has no NaN or Inf values. Certain CRS may also require the point to be within a specified range - this can be something we use a custom correction for. We may also want to wrap points around the antimeridian.
[ ] A linestring is valid if it is either empty, or has 2 or more coordinates. If closed, a linestring must not be self-intersecting. Previous requirements for all points constituting the linestring also apply. Linestrings are a special case IMO because they are the first level of abstraction - we don't want to decompose to points and then go back to searching the linestring again because it's pointless.
[ ] A linear ring is a subset of linestrings which must be:
[ ] A polygon must have an exterior, and optionally an interior.
[ ] A multipolygon must:
[ ] Geometry collections must:
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
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.