R/generate_spatial_lines.R
generate_spatial_lines.Rd
Generate spatial lines dataset from sensor configuration
generate_spatial_lines(config)
data.table, sensor configuration for multiple sensors
ansf
object with poly lines for each corridor and the line length
in miles
Lines are generated based on the detector's corridor route, direction, and category, defined specifically for I-35 and T.H.5 north and south of the cities, and east and west of the cities. When run with the full configuration dataset, it can result in some lines over 200 miles long and passing over areas where the road does not exist. Rather than running the entire configuration, identify specific corridors and sensors and narrow the configuration dataset to just those sensors.
If your goal is to map the entire road network, consider using one of the datasets available from MnDOT or the Metropolitan Council on Minnesota Geospatial Commons.
if (FALSE) {
library(tc.sensors)
library(ggplot2)
configuration <- pull_configuration()
spatial_lines <- generate_spatial_lines(config = configuration)
# generate map
ggplot() +
geom_sf(data = spatial_lines)
# generate line length histogram
ggplot() +
geom_histogram(data = spatial_lines, mapping = aes(x = length_miles))
}