Extracts the transit network from a network.dat file (built with setup_r5()) in sf format.




An object to connect with the R5 routing engine, created with setup_r5().


A list with two components of a transit network in sf format: route shapes (LINESTRING) and transit stops (POINT). The same route_id/short_name might appear with different geometries. This occurs when the same route is associated to more than one shape_ids in the GTFS feed used to create the transit network. Some transit stops might be returned with geometry POINT EMPTY (i.e. missing spatial coordinates). This may occur when a transit stop is not snapped to the road network, possibly because the GTFS feed used to create the transit network covers an area larger than the .osm.pbf input data.

See also

Other network functions: find_snap(), street_network_to_sf()



# build transport network
path <- system.file("extdata/poa", package = "r5r")
r5r_core <- setup_r5(path)
#> Using cached R5 version from /home/runner/.cache/R/r5r/r5-v7.0-all.jar
#> Using cached network.dat from /home/runner/work/_temp/Library/r5r/extdata/poa/network.dat

# extract transit network from r5r_core
transit_net <- transit_network_to_sf(r5r_core)

#> r5r_core has been successfully stopped.