Pair origins with destinations

get_od_pairs(origins, destinations, d_limit = Inf)

Arguments

origins

A data.frame or similar representing the origin locations. Should have only three columns, with the first column containing unique indices for each location, and the second and third column containing respectively the longitude and latitude coordinates of each location.

destinations

A data.frame or similar representing the possible destination locations. Should have only three columns, with the first column containing unique indices for each location, and the second and third column containing respectively the longitude and latitude coordinates of each location.

d_limit

Upper distance limit (as-the-crow-flies) in meters to pair an origin with a destination. Defaults to Inf, meaning that each origin will be paired with all possible destinations.

Value

A data.table object containing one origin-destination pair per row. The table has six columns named from, to, from_lon, from_lat, to_lon and to_lat, with the first two containing the indices of respectively the origin and destination, and the latter four containing their coordinates.

Note

Coordinates should be expressed in coordinate reference system EPSG:4326. The function assumes this to be true, and does not check for it.