Skip to contents

Work with OD data

od2line()
Convert origin-destination data to spatial lines
od2odf()
Extract coordinates from OD data
od_aggregate_from()
Summary statistics of trips originating from zones in OD data
od_aggregate_to()
Summary statistics of trips arriving at destination zones in OD data
od_coords()
Create matrices representing origin-destination coordinates
od_coords2line()
Convert origin-destination coordinates into desire lines
od_id_szudzik() od_id_max_min() od_id_character()
Combine two ID values to create a single ID number
od_id_order()
Generate ordered ids of OD pairs so lowest is always first This function is slow on large datasets, see szudzik_pairing for faster alternative
od_oneway()
Aggregate od pairs they become non-directional
od_to_odmatrix()
Convert origin-destination data from long to wide format
odmatrix_to_od()
Convert origin-destination data from wide to long format
points2flow()
Convert a series of points into geographical flows
points2odf()
Convert a series of points into a dataframe of origins and destinations

Work with (desire) lines

angle_diff()
Calculate the angular difference between lines and a predefined bearing
geo_toptail()
Clip the first and last n metres of SpatialLines
is_linepoint()
Identify lines that are points
line2df()
Convert geographic line objects to a data.frame with from and to coords
line2points() line2pointsn() line2vertices()
Convert a spatial (linestring) object to points
line_bearing()
Find the bearing of straight lines
line_breakup()
Break up line objects into shorter segments
line_midpoint()
Find the mid-point of lines
line_segment()
Divide an sf object with LINESTRING geometry into regular segments
line_segment1()
Segment a single line, using lwgeom or rsgeo
line_via()
Add geometry columns representing a route via intermediary points
mats2line()
Convert 2 matrices to lines
n_segments()
Vectorised function to calculate number of segments given a max segment length
n_vertices()
Retrieve the number of vertices in sf objects
onewaygeo()
Aggregate flows so they become non-directional (by geometry - the slow way)
points2line()
Convert a series of points, or a matrix of coordinates, into a line
toptail_buff()
Clip the beginning and ends of sf LINESTRING objects
line_cast()
Convert multilinestring object into linestrings

Work with and analyse routes

route_average_gradient()
Return average gradient across a route
route_rolling_average()
Return smoothed averages of vector
route_rolling_diff()
Return smoothed differences between vector values
route_rolling_gradient()
Calculate rolling average gradient from elevation data at segment level
route_sequential_dist()
Calculate the sequential distances between sequential coordinate pairs
route_slope_matrix()
Calculate the gradient of line segments from a matrix of coordinates
route_slope_vector()
Calculate the gradient of line segments from distance and elevation vectors
route()
Plan routes on the transport network
route_bikecitizens()
Get a route from the BikeCitizens web service
route_dodgr()
Route on local data using the dodgr package
route_google()
Find shortest path using Google services
route_nearest_point()
Find nearest route to a given point
route_network_sf
Spatial lines dataset representing a route network
route_network_small
Spatial lines dataset representing a small route network
route_osrm()
Plan routes on the transport network using the OSRM server
route_split()
Split route in two at point on or near network
route_split_id()
Split route based on the id or coordinates of one of its vertices
routes_fast_sf
Spatial lines dataset of commuter flows on the travel network
routes_slow_sf
Spatial lines dataset of commuter flows on the travel network

Routing

route()
Plan routes on the transport network
route_dodgr()
Route on local data using the dodgr package
route_osrm()
Plan routes on the transport network using the OSRM server

Work with nodes

geo_code()
Convert text strings into points on the map

Route network functions

rnet_add_node()
Add a node to route network
rnet_boundary_points() rnet_boundary_df() rnet_boundary_unique() rnet_boundary_points_lwgeom() rnet_duplicated_vertices()
Get points at the beginner and end of linestrings
rnet_breakup_vertices()
Break up an sf object with LINESTRING geometry.
rnet_connected()
Keep only segments connected to the largest group in a network
rnet_cycleway_intersection
Example of cycleway intersection data showing problems for SpatialLinesNetwork objects
rnet_get_nodes()
Extract nodes from route network
rnet_group()
Assign segments in a route network to groups
rnet_join()
Join route networks
rnet_merge()
Merge route networks, keeping attributes with aggregating functions
rnet_overpass
Example of overpass data showing problems for SpatialLinesNetwork objects
rnet_roundabout
Example of roundabout data showing problems for SpatialLinesNetwork objects
rnet_subset()
Subset one route network based on overlaps with another
overline() overline2()
Convert series of overlapping lines into a route network
overline_intersection()
Convert series of overlapping lines into a route network
gsection()
Function to split overlapping SpatialLines into segments
islines()
Do the intersections between two geometries create lines?

Geographic functions

bbox_scale()
Scale a bounding box
bind_sf()
Rapid row-binding of sf objects
geo_bb()
Flexible function to generate bounding boxes
geo_bb_matrix()
Create matrix representing the spatial bounds of an object
geo_buffer()
Perform a buffer operation on a temporary projected CRS
geo_length()
Calculate line length of line with geographic or projected CRS
geo_projected()
Perform GIS functions on a temporary, projected version of a spatial object
geo_select_aeq()
Select a custom projected CRS for the area of interest
quadrant()
Split a spatial object into quadrants
stplanr-deprecated
Deprecated functions in stplanr
stplanr-package stplanr
stplanr: Sustainable Transport Planning with R

Get transport data

cents_sf
Spatial points representing home locations
destinations_sf
Example destinations data
flow
Data frame of commuter flows
flow_dests
Data frame of invented commuter flows with destinations in a different layer than the origins
flowlines_sf
Spatial lines dataset of commuter flows
od_data_lines
Example of desire line representations of origin-destination data from UK Census
od_data_routes
Example segment-level route data
od_data_sample
Example of origin-destination data from UK Census
osm_net_example
Example of OpenStreetMap road network
read_table_builder()
Import and format Australian Bureau of Statistics (ABS) TableBuilder files
route_network_sf
Spatial lines dataset representing a route network
route_network_small
Spatial lines dataset representing a small route network
routes_fast_sf
Spatial lines dataset of commuter flows on the travel network
routes_slow_sf
Spatial lines dataset of commuter flows on the travel network
zones_sf
Spatial polygons of home locations for flow analysis.

Example data