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

Shortcut through simplification step if distanceTolerance is negative #1093

Merged
merged 1 commit into from
Nov 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public class DouglasPeuckerSimplifier {
* @return the simplified geometry
*/
public static Geometry simplify(Geometry geom, double distanceTolerance) {
if (geom.isEmpty()) {
if (geom.isEmpty() || (distanceTolerance < 0.0)) {
davecraig marked this conversation as resolved.
Show resolved Hide resolved
return geom.copy();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,21 @@ void simplifyLineStringIfToleranceIsSet() {
true
)
);
// but doesn't resimplify if the tolerance is negative even when resimplify=true
assertEquals(
List.of(
feature(1, newLineString(10, 10, 20, 20, 30, 30), Map.of("a", 1))
),
FeatureMerge.mergeLineStrings(
List.of(
feature(1, newLineString(10, 10, 20, 20, 30, 30), Map.of("a", 1))
),
0,
-1,
0,
true
)
);
}

@Test
Expand Down
Loading