New function — ms_union#170
Open
atsyplenkov wants to merge 2 commits into
Open
Conversation
added 2 commits
December 14, 2023 15:12
Owner
|
Thanks for this @atsyplenkov. Does this have very different behaviour to |
Author
|
Hi @ateucher! As far as I understand, not really. However, it does provide a significant increase in speed. See a quick reprex below. UPD: library(sf)
#> Linking to GEOS 3.11.2, GDAL 3.7.2, PROJ 9.3.0; sf_use_s2() is TRUE
library(rmapshaper)
library(terra)
file <- system.file("gpkg/nc.gpkg", package = "sf")
nc_sf <- read_sf(file)
nc_sf_buffer <-
st_buffer(nc_sf, 10^4)
# Convert to terra objects
nc_vect <- vect(nc_sf)
nc_buffer <- vect(nc_sf_buffer)
microbenchmark::microbenchmark(
st_union = {
st_union(nc_sf, nc_sf_buffer)
},
ms_union = {
ms_union(nc_sf, nc_sf_buffer)
},
union = {
terra::union(nc_vect, nc_buffer)
},
times = 10L
)
#> Unit: milliseconds
#> expr min lq mean median uq max
#> st_union 16926.3117 17169.587 17528.1777 17483.3264 17780.6008 18183.9126
#> ms_union 420.9673 440.738 460.7762 452.6254 477.9516 518.3586
#> union 3465.1852 3492.5957 3562.6814 3537.1537 3599.4537 3726.8144
#> neval cld
#> 10 a
#> 10 b
#> 10 cCreated on 2024-01-09 with reprex v2.0.2 |
Owner
|
That's pretty good! Thanks @atsyplenkov, I will probably take this PR, but I won't have time to work on the package for a little while, so I will look at it in detail then. |
Author
|
Hey, any update on this PR? |
Owner
|
Thanks for your patience @atsyplenkov - I will try and look at this in the next few weeks |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hi guys,
whenever you have a moment, could you please take a look at this? I propose to add
ms_unionfunction family which is a wrapper to-unioncommand.Cheers