Skip to contents

morph_road_network() converts map data from the RoboCup Rescue Simulation into a road network.

Usage

morph_road_network(map_data)

Arguments

map_data

rrs_map data, the GML map data loaded by the read_rrs_map().

Value

A list containing the network components:

  • nodes: A sf object of nodes with point geometries.

  • edges: A sf object of edges with linestring geometries.

Details

This road network consists of nodes and edges. Nodes are defined as the centroids of all areas and the center points the boundaries between areas. Edges connect nodes between an agent can travel.

Examples

gml <- system.file("extdata", "map-test.gml", package = "rrstools")
map_data <- read_rrs_map(gml)
network <- morph_road_network(map_data)
network
#> $nodes
#> Simple feature collection with 197 features and 3 fields
#> Geometry type: POINT
#> Dimension:     XY
#> Bounding box:  xmin: -21 ymin: -15 xmax: 120.7273 ymax: 110.9911
#> CRS:           NA
#> First 10 features:
#>     id     type degree                  geometry
#> 1  247 building      2            POINT (-20 30)
#> 2  248 building      1            POINT (15 -15)
#> 3  249 building      1            POINT (-21 55)
#> 4  250 building      1         POINT (95.5 98.5)
#> 5  251 building      1          POINT (35 -10.5)
#> 6  253 building      2 POINT (39.99393 110.9911)
#> 7  254 building      1 POINT (120.7273 62.72727)
#> 8  255 building      2 POINT (101.6462 -7.97594)
#> 9  256     road      3 POINT (11.55317 80.52697)
#> 10 257     road      2 POINT (73.35771 84.38836)
#> 
#> $edges
#> Simple feature collection with 204 features and 4 fields
#> Geometry type: LINESTRING
#> Dimension:     XY
#> Bounding box:  xmin: -21 ymin: -15 xmax: 120.7273 ymax: 110.9911
#> CRS:           NA
#> First 10 features:
#>     id     type from  to                       geometry
#> 1  247 building  247 317 LINESTRING (-20 30, -10.6 2...
#> 2  247 building  247 319 LINESTRING (-20 30, -10.6 3...
#> 3  248 building  248 339  LINESTRING (15 -15, 11.5 -10)
#> 4  249 building  249 303    LINESTRING (-21 55, -10 45)
#> 5  250 building  250 332  LINESTRING (95.5 98.5, 91 95)
#> 6  251 building  251 205   LINESTRING (35 -10.5, 35 -1)
#> 7  253 building  253 234 LINESTRING (39.99393 110.99...
#> 8  253 building  253 241 LINESTRING (39.99393 110.99...
#> 9  254 building  254 123 LINESTRING (120.7273 62.727...
#> 10 255 building  255 128 LINESTRING (101.6462 -7.975...
#> 
#> attr(,"class")
#> [1] "rrs_road_network" "list"