Skip to content

Add support for other classes #2

@agila5

Description

@agila5

As far as I know, there are a few more classes (other than sfnetwork) which are used in the R ecosystem to represent spatial networks. For example:

linnet

library(spatstat.linnet)
#> ...
plot(as.linnet(chicago), show.vertices = TRUE, pch = 16)

Created on 2025-05-29 with reprex v2.1.1.9000

dodgr

library(dodgr)

net <- weight_streetnet(hampi)
plot(net[c("from_lon", "from_lat")], pch = 16, cex = 0.5)
with(net, segments(from_lon, from_lat, to_lon, to_lat, col = "grey"))
points(net[c("from_lon", "from_lat")], pch = 16, cex = 0.5)

Created on 2025-05-29 with reprex v2.1.1.9000

MetricGraph

library(MetricGraph)
#> This is MetricGraph 1.5.0
#> - See https://davidbolin.github.io/MetricGraph for vignettes and manuals.
#> 
#> Attaching package: 'MetricGraph'
#> The following object is masked from 'package:stats':
#> 
#>     filter

pems_graph <- metric_graph$new(edges = pems$edges, verbose = FALSE)
pems_graph$add_observations(data = pems$data, normalized=TRUE, verbose = FALSE)
pems_graph$plot(type = "ggplot")

Created on 2025-05-29 with reprex v2.1.1.9000

If possible and in the long term, I believe it would be nice to add the possibility to plot also such objects.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions