od_coords: General function to create a matrix representing origins and...

Description Usage Arguments Examples

View source: R/od_coords.R

Description

This function takes a wide range of input data types (spatial lines, points or text strings) and returns a matrix of coordinates representing origin (fx, fy) and destination (tx, ty) points.

Usage

1
od_coords(from = NULL, to = NULL, l = NULL)

Arguments

from

An object representing origins (if lines are provided as the first argument, from is assigned to l)

to

An object representing destinations

l

Only needed if from and to are empty, in which case this should be a spatial object representing desire lines

Examples

1
2
3
4
5
6
od_coords(from = c(0, 52), to = c(1, 53)) # lon/lat coordinates
od_coords(from = cents[1, ], to = cents[2, ]) # Spatial points
od_coords(cents_sf[1:3, ], cents_sf[2:4, ]) # sf points
# od_coords("Hereford", "Leeds") # geocode locations
od_coords(flowlines[1:3, ])
od_coords(flowlines_sf[1:3, ])

stplanr documentation built on Jan. 7, 2019, 5:04 p.m.