-
Notifications
You must be signed in to change notification settings - Fork 20
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
Implement to_spatial_segmentation #210
base: main
Are you sure you want to change the base?
Conversation
One question: since the network is recreated with I see the name comes from PostGIS, but I think |
Merge branch 'develop' into dumpSegments # Conflicts: # NAMESPACE # man/spatial_morphers.Rd
Fixed
Do you mean something like the following example? # packages
library(sf)
library(tidygraph)
library(sfnetworks)
# data
my_sfc <- st_sfc(
st_linestring(rbind(c(-1, 0), c(0, 0), c(1, 0))),
st_linestring(rbind(c(0, -1), c(0, 0), c(0, 1)))
)
my_sfn <- as_sfnetwork(my_sfc)
my_sfn1 <- convert(my_sfn, to_spatial_segmentation, .clean = TRUE)
# plot
par(mfrow = c(1, 2), mar = rep(0, 4))
plot(my_sfn)
plot(my_sfn1) Created on 2022-09-08 by the reprex package (v2.0.1) We can notice that the morpher creates a new "link" between the existing edges (i.e. the new dot in the middle of the map). I'm not 100% sure that this is expected but:
|
Codecov ReportPatch coverage:
📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more Additional details and impacted files@@ Coverage Diff @@
## main #210 +/- ##
==========================================
- Coverage 67.92% 67.29% -0.63%
==========================================
Files 21 21
Lines 1593 1581 -12
==========================================
- Hits 1082 1064 -18
- Misses 511 517 +6
☔ View full report in Codecov by Sentry. |
Showcase of the new spatial morpher:
Created on 2022-06-08 by the reprex package (v2.0.1)
I know that the approach is not perfect (since we could also infer the new nodes without running
as_sfnetwork()
again), but I think it's good enough for the moment. If you don't have any particular comments, I will add examples and tests as soon as possible.cc @mkvasnicka