Giter Club home page Giter Club logo

Comments (6)

dr-jts avatar dr-jts commented on July 3, 2024

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.

from geos.

dr-jts avatar dr-jts commented on July 3, 2024

See JTS PR 682 and 683.

from geos.

jratike80 avatar jratike80 commented on July 3, 2024

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?

from geos.

dr-jts avatar dr-jts commented on July 3, 2024

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 GeometryFixer class for JTS (for eventual port into GEOS, since it has slightly different semantics to MakeValid. I'm not sure there's an obvious right answer. I do NOT think that the flat ring should be buffered or have points added, however, for reasons of performance and (more importantly) avoidance of introducing unexpected coordinates.

So the options for fixing a ring with too few points seem to be:

  • turn it into a LineString or a Point
  • turn it into a LINEARING EMPTY

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.

from geos.

jratike80 avatar jratike80 commented on July 3, 2024

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. POINT would do for that purpose. LINEARRING EMPTY is theoretically fine but otherwise useless, I think.

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.

from geos.

dr-jts avatar dr-jts commented on July 3, 2024

@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.

from geos.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.