paulmach / orb

Types and utilities for working with 2d geometry in Golang
MIT License
886 stars 103 forks source link

Set minimum points for a VisvalingamThreshold simplification #124

Closed albertyw closed 7 months ago

albertyw commented 1 year ago

Currently the VisvalingamThreshold simplification allows polygons to be simplified to 2 points which, at 0 area, is likely not the intention of the user nor does it produce a polygon that follows the geojson standard (#45). This changes the default to 3 points minimum.

Visvalingam and VisvalingamKeep will still allow users to explicitly specify 0, 1, or 2 points minimum if actually desired.

albertyw commented 1 year ago

Considering this more, I see that Visvalingam may be applied to LineStrings and other types which may have no expectation of a non-zero area or more than 2 unique points. Similar to the discussion in #45, perhaps that indicates there should be no minimum number of points (other than the minimum of 2 points being the organic result of applying the algorithm) and users may need to instead specify number of points explicitly. I'm no expert in geojson so I'd be happy to discuss approaches.

paulmach commented 7 months ago

this pr https://github.com/paulmach/orb/pull/140 updated "zero min points" to mean

I think that was the intention by this change.