-
Notifications
You must be signed in to change notification settings - Fork 371
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow construction of LinearRings with < 4 points #406
Comments
The minimum number of points in a LinearRing can definitely be reduced to 3, instead of 4. That will handle the data in both issues above. I haven't seen any data which requires a lower limit, so probably best to make the minimal change for now. |
I wonder what MakeValid should do. To remove the flat ring that does not have any area, or to maintain the topology by creating a minimal buffer or by adding a fourth point with a small offset? |
That's a very timely question, since I'm working on a So the options for fixing a ring with too few points seem to be:
There is the same issue for a ring with many points but which is flat, and a LineString with too few points. Another approach I am considering is that if the ring (or line) is an atomic geometry, then reduce it to a geometry of inherent dimensional type; OR if if the ring/line is part of a collection, then drop it. This avoids creating collections of mixed type, which are awkward to handle. Feedback welcome. |
When I think where I have met such geometries, OpenStreetMap data has always had them for some reason, and at least some MVT vector tile writers degenerate rings into straight lines occasionally. As a user of the data I would probably appreciate to have an option to get placeholders for locating those places because originally they may have been meaningful. Maybe in most cases I would like to get rid of the flat rings and others like in your latter approach. In typical GIS data degenerated things feel like something that is left from bad simplification. If data provider really wanted to use topology preserving simplification it is still impossible to fix the data afterwards because probably there are also successfully removed rings. The OpenStreetmap case is different because the contributor maybe digitized and tagged the data just that way and they just did not know how to do it right. My main vector tool is OpenJUMP so I do not fear collections, but for most GIS users they are complicated. |
@jratike80 Sounds like there needs to be some options for users to use when making valid geometries. At least one to indicate whether to drop collapsed elements, or to preserve them as lower-dimension elements. |
If we can't construct them, we can't repair them. As discussed at r-spatial/sf#1589 and locationtech/jts#558
The text was updated successfully, but these errors were encountered: