Package: stplanr 1.2.2

Robin Lovelace

stplanr: Sustainable Transport Planning

Tools for transport planning with an emphasis on spatial transport data and non-motorized modes. The package was originally developed to support the 'Propensity to Cycle Tool', a publicly available strategic cycle network planning tool (Lovelace et al. 2017) <doi:10.5198/jtlu.2016.862>, but has since been extended to support public transport routing and accessibility analysis (Moreno-Monroy et al. 2017) <doi:10.1016/j.jtrangeo.2017.08.012> and routing with locally hosted routing engines such as 'OSRM' (Lowans et al. 2023) <doi:10.1016/j.enconman.2023.117337>. The main functions are for creating and manipulating geographic "desire lines" from origin-destination (OD) data (building on the 'od' package); calculating routes on the transport network locally and via interfaces to routing services such as <https://cyclestreets.net/> (Desjardins et al. 2021) <doi:10.1007/s11116-021-10197-1>; and calculating route segment attributes such as bearing. The package implements the 'travel flow aggregration' method described in Morgan and Lovelace (2020) <doi:10.1177/2399808320942779> and the 'OD jittering' method described in Lovelace et al. (2022) <doi:10.32866/001c.33873>. Further information on the package's aim and scope can be found in the vignettes and in a paper in the R Journal (Lovelace and Ellison 2018) <doi:10.32614/RJ-2018-053>, and in a paper outlining the landscape of open source software for geographic methods in transport planning (Lovelace, 2021) <doi:10.1007/s10109-020-00342-2>.

Authors:Robin Lovelace [aut, cre], Richard Ellison [aut], Malcolm Morgan [aut], Barry Rowlingson [ctb], Nick Bearman [ctb], Nikolai Berkoff [ctb], Scott Chamberlain [rev], Mark Padgham [ctb], Zhao Wang [ctb], Andrea Gilardi [ctb], Josiah Parry [ctb]

stplanr_1.2.2.tar.gz
stplanr_1.2.2.zip(r-4.5)stplanr_1.2.2.zip(r-4.4)stplanr_1.2.2.zip(r-4.3)
stplanr_1.2.2.tgz(r-4.4-any)stplanr_1.2.2.tgz(r-4.3-any)
stplanr_1.2.2.tar.gz(r-4.5-noble)stplanr_1.2.2.tar.gz(r-4.4-noble)
stplanr_1.2.2.tgz(r-4.4-emscripten)stplanr_1.2.2.tgz(r-4.3-emscripten)
stplanr.pdf |stplanr.html
stplanr/json (API)
NEWS

# Install 'stplanr' in R:
install.packages('stplanr', repos = c('https://ropensci.r-universe.dev', 'https://cloud.r-project.org'))

Peer review:

Bug tracker:https://github.com/ropensci/stplanr/issues

Datasets:
  • 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
  • rnet_cycleway_intersection - Example of cycleway intersection data showing problems for SpatialLinesNetwork objects
  • rnet_overpass - Example of overpass data showing problems for SpatialLinesNetwork objects
  • rnet_roundabout - Example of roundabout data showing problems for SpatialLinesNetwork objects
  • 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.

On CRAN:

cyclecyclingdesire-linesorigin-destinationpeer-reviewedpubic-transportroute-networkroutesroutingspatialtransporttransport-planningtransportationwalking

12.34 score 421 stars 3 packages 648 scripts 2.0k downloads 1 mentions 79 exports 47 dependencies

Last updated 3 months agofrom:295ec8e0ae (on master). Checks:OK: 3 NOTE: 4. Indexed: yes.

TargetResultDate
Doc / VignettesOKNov 21 2024
R-4.5-winOKNov 21 2024
R-4.5-linuxOKNov 21 2024
R-4.4-winNOTENov 21 2024
R-4.4-macNOTENov 21 2024
R-4.3-winNOTENov 21 2024
R-4.3-macNOTENov 21 2024

Exports:%>%angle_diffbb2polybbox_scalegeo_bbgeo_bb_matrixgeo_buffergeo_codegeo_lengthgeo_projectedgeo_select_aeqgeo_toptailgsectionis_linepointislinesline_bearingline_breakupline_castline_midpointline_segmentline_segment1line_vialine2dfline2pointsline2pointsnline2verticesmats2linen_segmentsn_verticesod_aggregate_fromod_aggregate_tood_coordsod_coords2lineod_id_characterod_id_max_minod_id_orderod_id_szudzikod_onewayod_to_odmatrixod2lineod2odfodmatrix_to_odonewaygeooverlineoverline_intersectionoverline2points2flowpoints2linepoints2odfquadrantread_table_builderrnet_add_nodernet_boundary_dfrnet_boundary_pointsrnet_boundary_points_lwgeomrnet_boundary_uniquernet_breakup_verticesrnet_connectedrnet_duplicated_verticesrnet_get_nodesrnet_grouprnet_joinrnet_mergernet_subsetrouteroute_average_gradientroute_dodgrroute_googleroute_nearest_pointroute_osrmroute_rolling_averageroute_rolling_diffroute_rolling_gradientroute_sequential_distroute_slope_matrixroute_slope_vectorroute_splitroute_split_idtoptail_buff

Dependencies:askpassBHclassclassIntclicurldata.tableDBIdplyre1071fansigenericsgeometriesgeospheregluehttrjsonliteKernSmoothlatticelifecyclelwgeommagrittrMASSmimenaborodopensslpbapplypillarpkgconfigproxyR6RcppRcppEigenrlangs2sfsfheadersspsystibbletidyselectunitsutf8vctrswithrwk

Introducing stplanr

Rendered fromstplanr.Rmdusingknitr::rmarkdownon Nov 21 2024.

Last update: 2023-09-15
Started: 2019-03-20

Merging route networks

Rendered frommerging-route-networks.Rmdusingknitr::rmarkdownon Nov 21 2024.

Last update: 2024-03-14
Started: 2023-08-16

Origin-destination data with stplanr

Rendered fromstplanr-od.Rmdusingknitr::rmarkdownon Nov 21 2024.

Last update: 2023-09-15
Started: 2019-07-06

Parallel routing and performance with stplanr

Rendered fromstplanr-parallel.Rmdusingknitr::rmarkdownon Nov 21 2024.

Last update: 2020-04-06
Started: 2020-01-25

Route networks with stplanr

Rendered fromstplanr-route-nets.Rmdusingknitr::rmarkdownon Nov 21 2024.

Last update: 2023-09-14
Started: 2019-07-06

stplanr: A Package for Transport Planning

Rendered fromstplanr-paper.Rmdusingknitr::rmarkdownon Nov 21 2024.

Last update: 2024-04-25
Started: 2016-11-18

Transport routing with stplanr

Rendered fromstplanr-routing.Rmdusingknitr::rmarkdownon Nov 21 2024.

Last update: 2021-10-12
Started: 2019-07-06

Readme and manuals

Help Manual

Help pageTopics
*stplanr: Sustainable Transport Planning with R*stplanr-package stplanr
Calculate the angular difference between lines and a predefined bearingangle_diff
Scale a bounding boxbbox_scale
Rapid row-binding of sf objectsbind_sf
Spatial points representing home locationscents_sf
Example destinations datadestinations_sf
Data frame of commuter flowsflow
Data frame of invented commuter flows with destinations in a different layer than the originsflow_dests
Spatial lines dataset of commuter flowsflowlines_sf
Flexible function to generate bounding boxesbb2poly geo_bb
Create matrix representing the spatial bounds of an objectgeo_bb_matrix
Perform a buffer operation on a temporary projected CRSgeo_buffer
Convert text strings into points on the mapgeo_code
Calculate line length of line with geographic or projected CRSgeo_length
Perform GIS functions on a temporary, projected version of a spatial objectgeo_projected gprojected
Select a custom projected CRS for the area of interestgeo_select_aeq
Clip the first and last n metres of SpatialLinesgeo_toptail toptail
Function to split overlapping SpatialLines into segmentsgsection
Identify lines that are pointsis_linepoint
Do the intersections between two geometries create lines?islines
Find the bearing of straight linesline_bearing
Break up line objects into shorter segmentsline_breakup
Convert multilinestring object into linestringsline_cast
Find the mid-point of linesline_midpoint
Divide an sf object with LINESTRING geometry into regular segmentsline_segment
Segment a single line, using lwgeom or rsgeoline_segment1
Add geometry columns representing a route via intermediary pointsline_via
Convert geographic line objects to a data.frame with from and to coordsline2df
Convert a spatial (linestring) object to pointsline2points line2pointsn line2vertices
Convert 2 matrices to linesmats2line
Vectorised function to calculate number of segments given a max segment lengthn_segments
Retrieve the number of vertices in sf objectsn_vertices
Summary statistics of trips originating from zones in OD dataod_aggregate_from
Summary statistics of trips arriving at destination zones in OD dataod_aggregate_to
Create matrices representing origin-destination coordinatesod_coords
Convert origin-destination coordinates into desire linesod_coords2line
Example of desire line representations of origin-destination data from UK Censusod_data_lines
Example segment-level route dataod_data_routes
Example of origin-destination data from UK Censusod_data_sample
Combine two ID values to create a single ID numberod_id od_id_character od_id_max_min od_id_szudzik
Generate ordered ids of OD pairs so lowest is always first This function is slow on large datasets, see szudzik_pairing for faster alternativeod_id_order
Aggregate od pairs they become non-directionalod_oneway
Convert origin-destination data from long to wide formatod_to_odmatrix
Convert origin-destination data to spatial linesod2line
Extract coordinates from OD dataod2odf
Convert origin-destination data from wide to long formatodmatrix_to_od
Aggregate flows so they become non-directional (by geometry - the slow way)onewaygeo
Example of OpenStreetMap road networkosm_net_example
Convert series of overlapping lines into a route networkoverline overline2
Convert series of overlapping lines into a route networkoverline_intersection
Convert a series of points into geographical flowspoints2flow
Convert a series of points, or a matrix of coordinates, into a linepoints2line
Convert a series of points into a dataframe of origins and destinationspoints2odf
Split a spatial object into quadrantsquadrant
Import and format Australian Bureau of Statistics (ABS) TableBuilder filesread_table_builder
Add a node to route networkrnet_add_node
Get points at the beginner and end of linestringsrnet_boundary_df rnet_boundary_points rnet_boundary_points_lwgeom rnet_boundary_unique rnet_duplicated_vertices
Break up an sf object with LINESTRING geometry.rnet_breakup_vertices
Keep only segments connected to the largest group in a networkrnet_connected
Example of cycleway intersection data showing problems for SpatialLinesNetwork objectsrnet_cycleway_intersection
Extract nodes from route networkrnet_get_nodes
Assign segments in a route network to groupsrnet_group rnet_group.default rnet_group.sf rnet_group.sfc
Join route networksrnet_join
Merge route networks, keeping attributes with aggregating functionsrnet_merge
Example of overpass data showing problems for SpatialLinesNetwork objectsrnet_overpass
Example of roundabout data showing problems for SpatialLinesNetwork objectsrnet_roundabout
Subset one route network based on overlaps with anotherrnet_subset
Plan routes on the transport networkroute
Return average gradient across a routeroute_average_gradient
Get a route from the BikeCitizens web serviceroute_bikecitizens
Route on local data using the dodgr packageroute_dodgr
Find shortest path using Google servicesroute_google
Find nearest route to a given pointroute_nearest_point
Spatial lines dataset representing a route networkroute_network_sf
Spatial lines dataset representing a small route networkroute_network_small
Plan routes on the transport network using the OSRM serverroute_osrm
Return smoothed averages of vectorroute_rolling_average
Return smoothed differences between vector valuesroute_rolling_diff
Calculate rolling average gradient from elevation data at segment levelroute_rolling_gradient
Calculate the sequential distances between sequential coordinate pairsroute_sequential_dist
Calculate the gradient of line segments from a matrix of coordinatesroute_slope_matrix
Calculate the gradient of line segments from distance and elevation vectorsroute_slope_vector
Split route in two at point on or near networkroute_split
Split route based on the id or coordinates of one of its verticesroute_split_id
Spatial lines dataset of commuter flows on the travel networkroutes_fast_sf
Spatial lines dataset of commuter flows on the travel networkroutes_slow_sf
Deprecated functions in stplanrstplanr-deprecated
Clip the beginning and ends of 'sf' LINESTRING objectstoptail_buff
Spatial polygons of home locations for flow analysis.zones_sf