Skip to content

Commit

Permalink
Fix #96
Browse files Browse the repository at this point in the history
  • Loading branch information
atsyplenkov committed Nov 18, 2024
1 parent 03a6217 commit 42f1536
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions R/geos-plot.R
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,16 @@ plot.geos_geometry <- function(x, ..., asp = 1, bbox = NULL, xlab = "", ylab = "
x_plot <- x_plot[x_touching]
dots_vector <- lapply(dots_vector, vctrs::vec_slice, x_touching)
}


x_valid <- geos_is_valid(x_plot)
if (simplify > 0) {
x_plot <- geos_simplify(x_plot, resolution_usr * simplify)
# Use topology-preserving simplification for invalid geometries
if (!all(x_valid)) {
x_plot <- geos_simplify_preserve_topology(x_plot, resolution_usr * simplify)
} else {
# Use faster regular simplification for valid geometries
x_plot <- geos_simplify(x_plot, resolution_usr * simplify)
}
}

if (!ignore_bbox && crop) {
Expand Down

0 comments on commit 42f1536

Please sign in to comment.