Skip to content
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

Enhance coverage simplification to handle one tolerance per geometry #1037

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

nstrahl
Copy link

@nstrahl nstrahl commented Mar 10, 2024

An enhancement has been made to the coverage simplification algorithm (simplify and simplifyInner). Currently, coverage simplification only allows one global tolerance value to be specified for the entire coverage. The proposed enhancement allows multiple tolerances to be passed in as a list, where each entry corresponds to a geometry. The geometries can thus be simplified with different tolerances while still ensuring topological correctness. At coinciding coverage edges the lowest available value is utilized.

This will be very useful for solving problems related to the boundary discretization of tessellated geometries.

The following figure shows an example where the boundary polygon is simplified with a tolerance of 1, and the other hole polygons with 1 and 0.5.

coverage1

Here is another one with tolerances of 50 and 10.

coverage2

… geometry)

Signed-off-by: N_Strahl <bowsher228@gmail.com>
* @param tolerances comma-separated string of simplification tolerances for each coverage
* @return the simplified polygons
*/
public static Geometry[] simplify(Geometry[] coverage, String tolerances) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Conversion from a string to an array of tolerances should be left up to client code, since it's highly usage-specific. It can be done in CoverageFunctions as well, to allow for easier testing and experimentation.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, then I will be moving that method into the JTS test builder code

…ts-app

Signed-off-by: N_Strahl <bowsher228@gmail.com>
@dr-jts
Copy link
Contributor

dr-jts commented Mar 11, 2024

The class Javadoc needs some mention of the semantics when using tolerance-per-geometry. Specifically, there should be a comment like:

The simplifier allows specifying the simplification tolerance separately for each input geometry.  Shared edges are simplified using the lowest of the tolerances for the adjacent geometries (i.e. the least amount of simplification is performed). This allows specific geometries in a coverage to be simplified less than other geometries (or to force their boundary to be preserved without simplification).

Signed-off-by: N_Strahl <bowsher228@gmail.com>
@nstrahl nstrahl requested a review from dr-jts April 5, 2024 07:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants