Learn R Programming

dodgr (version 0.1.1)

dodgr_to_sf: dodgr_to_sf

Description

Convert a dodgr graph as data.frame of all edges into a Simple Features (sf) object through aggregating edges into LINESTRING objects representing longest sequences between all junction nodes. The resultant objects will generally contain more LINESTRING objects than the original sf object, because the former will be bisected at every junction point.

Usage

dodgr_to_sf(net)

Arguments

net

A dodgr network

Value

A list containing (1) A data.frame of data associated with the `sf` geometries; and (ii) A Simple Features Collection (sfc) list of LINESTRING objects.

Examples

Run this code
# NOT RUN {
hw <- weight_streetnet (hampi)
xy <- dodgr_to_sfc (hw)
dim (hw) # 5.845 edges
length (xy$geom) # 682 aggregated linestrings aggregated from those edges
nrow (hampi) # compared to 191 linestrings in original sf object
dim (xy$dat) # same number of rows as there are geometries
# }

Run the code above in your browser using DataLab