Replies: 3 comments 13 replies
-
Nice idea! I think we could do it the same way as the |
Beta Was this translation helpful? Give feedback.
-
A rough implementation with a toy example: library(sfnetworks)
library(mapview)
# Setup
setOldClass("sfnetwork")
setMethod(
f = "mapView",
signature = "sfnetwork",
definition = function(x, draw_lines = TRUE, ...) {
nodes <- sf::st_as_sf(x, "nodes")
m1 <- mapview(nodes, ...)
if (draw_lines) {
x <- sfnetworks:::explicitize_edges(x)
edges <- sf::st_as_sf(x, "edges")
m2 <- mapview(edges, ...)
m1 + m2
} else {
m1
}
}
)
# Toy example
sfn <- as_sfnetwork(roxel)
mapview(sfn, legend = NULL) Created on 2023-07-31 with reprex v2.0.2 I think we can play with it a little bit and then propose it to mapview as a PR (might be easier than adding it to |
Beta Was this translation helpful? Give feedback.
-
Could be a good one for |
Beta Was this translation helpful? Give feedback.
-
My favourite approach for interactively exploring spatial data is
mapview
(and this probably the first R code that @Robinlovelace taught to me while I was in Leeds 🤣). Unfortunately, at the moment there is no way for directly plotting ansfnetwork
object with mapview.We can always escape the spatial dimension, for example:
Created on 2021-02-15 by the reprex package (v0.3.0)
but, if you agree, I think that the best solution is to add a new method (here or in mapview package). It's not really that important, but I could work on this addition in the next weeks.
Beta Was this translation helpful? Give feedback.
All reactions