| Title: | Access the ArcGIS Routing and Network Analysis Services |
| Version: | 1.0.0 |
| Description: | Bindings to the ArcGIS Routing REST API (https://developers.arcgis.com/rest/routing/) for solving network analysis problems. Plan routes and generate driving directions, measure travel time and distance with origin-destination cost matrices, build service areas, find the closest facilities, route fleets of vehicles, and snap GPS tracks to roads. Both synchronous requests and asynchronous geoprocessing jobs are supported, returning simple features ('sf') objects ready for analysis and mapping. |
| License: | Apache License (≥ 2) |
| Encoding: | UTF-8 |
| Language: | en |
| RoxygenNote: | 7.3.3 |
| Imports: | arcgisutils, cli, httr2, sf, yyjsonr, vctrs, RcppSimdJson, rlang, hms |
| Depends: | R (≥ 4.3) |
| Suggests: | readr, heck, brio, wk, testthat (≥ 3.0.0) |
| Config/testthat/edition: | 3 |
| URL: | http://r.esri.com/arcgisrouting/, https://github.com/r-arcgis/arcgisrouting |
| BugReports: | https://github.com/r-arcgis/arcgisrouting/issues |
| NeedsCompilation: | yes |
| Packaged: | 2026-06-30 21:55:24 UTC; josiahparry |
| Author: | Josiah Parry |
| Maintainer: | Josiah Parry <josiah.parry@gmail.com> |
| Repository: | CRAN |
| Date/Publication: | 2026-07-07 09:30:21 UTC |
arcgisrouting: Access the ArcGIS Routing and Network Analysis Services
Description
Bindings to the ArcGIS Routing REST API (https://developers.arcgis.com/rest/routing/) for solving network analysis problems. Plan routes and generate driving directions, measure travel time and distance with origin-destination cost matrices, build service areas, find the closest facilities, route fleets of vehicles, and snap GPS tracks to roads. Both synchronous requests and asynchronous geoprocessing jobs are supported, returning simple features ('sf') objects ready for analysis and mapping.
Author(s)
Maintainer: Josiah Parry josiah.parry@gmail.com (ORCID)
See Also
Useful links:
Report bugs at https://github.com/r-arcgis/arcgisrouting/issues
Decode Compressed Geometry
Description
Decodes ArcGIS compressed geometry strings and converts them to an sfc object.
Usage
decode_compressed_geometry(geometry)
Arguments
geometry |
Character vector containing compressed geometry strings. |
Value
An sfc object with LIENSTRING geometries in EPSG:4326.
References
maslke/arcgis-compressed-geometry
Download Origin-Destination Cost Matrix Results
Description
Downloads and unzips the result file produced by a completed origin-destination cost matrix geoprocessing job, reading each CSV output into a named list of data frames with snake_case column names.
Usage
download_od_results(job)
Arguments
job |
A completed origin-destination cost matrix job object. |
Value
A named list of data frames, one per CSV output, with snake_case names derived from the output file names.
See Also
Other async:
download_service_area_results(),
find_closest_facilities_job(),
find_routes_job(),
find_service_areas_job(),
last_mile_delivery(),
location_allocation_job(),
od_cost_matrix_job(),
route_vehicles_job()
Other od:
od_cost_matrix(),
od_cost_matrix_job()
Examples
## Not run:
# This example is not executed since it requires a network connection
# to ArcGIS Online and a valid authentication token
library(sf)
library(arcgisutils)
set_arc_token(auth_user())
origins <- st_sfc(
st_point(c(-122.4194, 37.7749)),
st_point(c(-122.4313, 37.7793)),
crs = 4326
)
destinations <- st_sfc(
st_point(c(-122.4083, 37.7858)),
st_point(c(-122.4000, 37.7900)),
crs = 4326
)
job <- od_cost_matrix_job(origins, destinations)
job$start()
job$await()
download_od_results(job)
## End(Not run)
Download Service Area Results
Description
Downloads and unzips the result file produced by a completed service area geoprocessing job, parsing each JSON output into a named list of data frames with snake_case column names.
Usage
download_service_area_results(job)
Arguments
job |
A completed service area job object. |
Value
A named list of data frames, one per JSON output, with snake_case names derived from the output file names.
See Also
Other async:
download_od_results(),
find_closest_facilities_job(),
find_routes_job(),
find_service_areas_job(),
last_mile_delivery(),
location_allocation_job(),
od_cost_matrix_job(),
route_vehicles_job()
Other service area:
find_service_areas(),
find_service_areas_job()
Examples
## Not run:
# This example is not executed since it requires a network connection
# to ArcGIS Online and a valid authentication token
library(sf)
library(arcgisutils)
set_arc_token(auth_user())
facilities <- st_sfc(
st_point(c(-122.4194, 37.7749)),
st_point(c(-122.0312, 37.3318)),
crs = 4326
)
job <- find_service_areas_job(facilities, break_values = c(5, 10, 15))
job$start()
job$await()
download_service_area_results(job)
## End(Not run)
Find Closest Facilities
Description
Finds one or more nearby facilities from incidents based on travel time or distance.
Usage
find_closest_facilities(
incidents,
facilities,
travel_mode = NULL,
default_target_facility_count = NULL,
travel_direction = NULL,
default_cutoff = NULL,
time_of_day = NULL,
time_of_day_usage = NULL,
u_turns = NULL,
use_hierarchy = NULL,
impedance = NULL,
accumulate_impedance = NULL,
restrictions = NULL,
attribute_parameter_values = NULL,
point_barriers = NULL,
line_barriers = NULL,
polygon_barriers = NULL,
return_geometry = c("facilities", "incidents"),
directions_language = NULL,
directions_output_type = NULL,
directions_style = NULL,
directions_length_units = NULL,
directions_time_attribute = NULL,
output_lines = "true_shape",
ignore_invalid_locations = TRUE,
preserve_object_id = FALSE,
return_empty_results = FALSE,
output_geometry_precision = 10,
output_geometry_precision_units = "meters",
geometry_precision = NULL,
geometry_precision_m = NULL,
locate_settings = NULL,
crs = 4326,
token = arcgisutils::arc_token()
)
Arguments
incidents |
an |
facilities |
an |
travel_mode |
Character. The name of the travel mode to use. See
|
default_target_facility_count |
default |
travel_direction |
default |
default_cutoff |
default |
time_of_day |
default |
time_of_day_usage |
default |
u_turns |
default |
use_hierarchy |
Logical. Whether to use hierarchy when finding routes.
Default: |
impedance |
default |
accumulate_impedance |
default |
restrictions |
Character vector. Restriction names to honor.
Default: |
attribute_parameter_values |
default |
point_barriers |
default |
line_barriers |
default |
polygon_barriers |
Polygon barriers as |
return_geometry |
default |
directions_language |
Character. Language code for directions (e.g., |
directions_output_type |
default |
directions_style |
default |
directions_length_units |
default |
directions_time_attribute |
default |
output_lines |
default |
ignore_invalid_locations |
Logical. Whether to ignore invalid locations.
Default: |
preserve_object_id |
default |
return_empty_results |
default |
output_geometry_precision |
default |
output_geometry_precision_units |
default |
geometry_precision |
default |
geometry_precision_m |
default |
locate_settings |
default |
crs |
default |
token |
Authorization token. Default: |
Value
A named list. Elements present depend on return_geometry:
-
cf_routes: route features between incidents and facilities -
facilities: facility features -
incidents: incident features -
direction_points: point features for direction maneuvers -
direction_lines: line features for route segments -
barriers: point barrier features -
polyline_barriers: polyline barrier features -
polygon_barriers: polygon barrier features -
traversed_edges: traversed edge features -
traversed_junctions: traversed junction features -
traversed_turns: traversed turn features -
messages: status and warning messages from the service
References
See Also
Other direct:
find_routes(),
find_service_areas(),
od_cost_matrix(),
route_vehicles(),
snap_to_roads()
Other closest facility:
find_closest_facilities_job()
Examples
## Not run:
# This example is not executed since it requires a network connection
# to ArcGIS Online and a valid authentication token
library(sf)
library(arcgisutils)
set_arc_token(auth_user())
incidents <- st_sfc(st_point(c(-122.4496, 37.7467)), crs = 4326)
facilities <- st_sf(
name = c("Station 11", "Station 20", "Station 24", "Station 39"),
geometry = st_sfc(
st_point(c(-122.4267, 37.7486)),
st_point(c(-122.4561, 37.7513)),
st_point(c(-122.4409, 37.7533)),
st_point(c(-122.4578, 37.7407)),
crs = 4326
)
)
result <- find_closest_facilities(
incidents = incidents,
facilities = facilities,
default_target_facility_count = 2,
travel_direction = "away",
default_cutoff = 3,
return_geometry = "cf_routes",
directions_length_units = "miles",
crs = 3857
)
result
## End(Not run)
Find Closest Facilities (Async)
Description
Submits an asynchronous geoprocessing job that finds one or more nearby
facilities from incidents based on travel time or travel distance using the
ArcGIS /FindClosestFacilities GP service.
Usage
find_closest_facilities_job(
incidents,
facilities,
travel_mode = NULL,
number_of_facilities_to_find = NULL,
cutoff = NULL,
travel_direction = NULL,
measurement_units = NULL,
analysis_region = NULL,
time_of_day = NULL,
time_of_day_usage = NULL,
uturn_at_junctions = NULL,
use_hierarchy = NULL,
restrictions = NULL,
attribute_parameter_values = NULL,
time_impedance = NULL,
distance_impedance = NULL,
impedance = NULL,
point_barriers = NULL,
line_barriers = NULL,
polygon_barriers = NULL,
route_shape = NULL,
route_line_simplification_tolerance = NULL,
populate_directions = NULL,
directions_language = NULL,
directions_distance_units = NULL,
directions_style_name = NULL,
save_route_data = NULL,
save_output_network_analysis_layer = NULL,
output_format = "feature_set",
ignore_invalid_locations = TRUE,
token = arcgisutils::arc_token()
)
Arguments
incidents |
An |
facilities |
An |
travel_mode |
Character. The name or ID of the travel mode to use.
See |
number_of_facilities_to_find |
Integer. The number of closest
facilities to find per incident. Default: |
cutoff |
Numeric. The travel time or travel distance value at which to
stop searching for facilities for a given incident. Units are determined by
|
travel_direction |
Character. Direction the closest facility search is
measured. One of: |
measurement_units |
Character. Units for reporting total travel time or
distance. One of: |
analysis_region |
Character. Region for the analysis. One of:
|
time_of_day |
POSIXct. The departure time for the routes. When |
time_of_day_usage |
Character. Whether |
uturn_at_junctions |
Character. U-turn policy at junctions. One of:
|
use_hierarchy |
Logical. Whether to use the street hierarchy when
finding routes. Default: |
restrictions |
Character vector. Restriction names to apply.
Default: |
attribute_parameter_values |
List. Additional values for attributes or restrictions, passed through as a JSON object. Default: |
time_impedance |
Character. Time-based impedance. One of:
|
distance_impedance |
Character. Distance-based impedance. One of:
|
impedance |
Character. Impedance type. One of: |
point_barriers |
Point barriers as |
line_barriers |
Line barriers as |
polygon_barriers |
Polygon barriers as |
route_shape |
Character. Shape of the output route features. One of:
|
route_line_simplification_tolerance |
List with elements |
populate_directions |
Logical. Generate driving directions.
Default: |
directions_language |
Character. Language code for directions.
Default: |
directions_distance_units |
Character. Units for distances in
directions. One of: |
directions_style_name |
Character. Formatting style for directions.
One of: |
save_route_data |
Logical. Whether the route data is saved as a |
save_output_network_analysis_layer |
Logical. Whether to save the analysis as a network analysis layer package file. Default: |
output_format |
Character. Format for output features. One of:
|
ignore_invalid_locations |
Logical. Whether to ignore invalid
input locations. Default: |
token |
Authorization token. Default: |
Value
A find_closest_facilities_job R6 object inheriting from
arcgisutils::arc_gp_job. Call $start() to submit and $results to
retrieve output.
References
See Also
Other async:
download_od_results(),
download_service_area_results(),
find_routes_job(),
find_service_areas_job(),
last_mile_delivery(),
location_allocation_job(),
od_cost_matrix_job(),
route_vehicles_job()
Other closest facility:
find_closest_facilities()
Examples
## Not run:
# This example is not executed since it requires a network connection
# to ArcGIS Online and a valid authentication token
library(sf)
library(arcgisutils)
set_arc_token(auth_user())
incidents <- st_sfc(st_point(c(-122.4496, 37.7467)), crs = 4326)
facilities <- st_sf(
name = c("Station 11", "Station 20", "Station 24", "Station 39"),
geometry = st_sfc(
st_point(c(-122.4267, 37.7486)),
st_point(c(-122.4561, 37.7513)),
st_point(c(-122.4409, 37.7533)),
st_point(c(-122.4578, 37.7407)),
crs = 4326
)
)
job <- find_closest_facilities_job(
incidents,
facilities,
number_of_facilities_to_find = 2,
travel_direction = "facility",
cutoff = 5,
measurement_units = "minutes",
populate_directions = TRUE
)
job$start()
result <- job$results
## End(Not run)
Find Routes
Description
Finds the best routes between multiple stops using the ArcGIS routing service.
Usage
find_routes(
stops,
travel_mode = NULL,
start_time = NULL,
find_best_sequence = FALSE,
preserve_first_stop = TRUE,
preserve_last_stop = TRUE,
restrict_u_turns = NULL,
use_hierarchy = NULL,
impedance_attribute_name = NULL,
accumulate_attribute_names = NULL,
restrictions = NULL,
barriers = NULL,
polyline_barriers = NULL,
polygon_barriers = NULL,
directions_language = "en",
directions_type = "standard",
return_geometry = c("routes", "directions"),
ignore_invalid_locations = TRUE,
token = arcgisutils::arc_token()
)
Arguments
stops |
An |
travel_mode |
Character. The name of the travel mode to use. See
|
start_time |
POSIXct or character. The time at which travel begins.
Can be |
find_best_sequence |
Logical. Whether to reorder stops to find the
optimized route. Default: |
preserve_first_stop |
Logical. Whether to keep the first stop fixed
when reordering. Only applies if |
preserve_last_stop |
Logical. Whether to keep the last stop fixed
when reordering. Only applies if |
restrict_u_turns |
Character. Specifies U-turn restrictions. One of:
|
use_hierarchy |
Logical. Whether to use hierarchy when finding routes.
Default: |
impedance_attribute_name |
Character. The impedance to use. One of:
|
accumulate_attribute_names |
Character vector. Additional impedance
values to accumulate. Default: |
restrictions |
Character vector. Restriction names to honor.
Default: |
barriers |
Point barriers as |
polyline_barriers |
Line barriers as |
polygon_barriers |
Polygon barriers as |
directions_language |
Character. Language code for directions (e.g., |
directions_type |
Character. Specifies the content and verbosity of driving
directions ( |
return_geometry |
Character vector. Specifies which features to return
in the output. Valid values: |
ignore_invalid_locations |
Logical. Whether to ignore invalid locations.
Default: |
token |
Authorization token. Default: |
Value
A list containing the routing resps. The elements returned depend
on the return_geometry parameter. Possible elements include:
-
routes: Route features -
directions: Driving directions. Each element contains acompress_geometrycolumn with per-maneuver segment geometry in ArcGIS compressed format. Usedecode_compressed_geometry()to decode these into sf geometries. -
stops: Stop features -
barriers: Barrier features -
polyline_barriers: Polyline barrier features -
polygon_barriers: Polygon barrier features -
traversed_edges: Traversed edge features -
traversed_junctions: Traversed junction features -
traversed_turns: Traversed turn features -
messages: Status and warning messages from the service
When directions_type = "feature_sets", the response includes:
-
direction_points: sf object with point features for direction maneuvers -
direction_lines: sf object with line features for route segments
References
See Also
Other direct:
find_closest_facilities(),
find_service_areas(),
od_cost_matrix(),
route_vehicles(),
snap_to_roads()
Other routing:
find_routes_job()
Examples
## Not run:
# This example is not executed since it requires a network connection
# to ArcGIS Online and a valid authentication token
library(sf)
library(arcgisutils)
set_arc_token(auth_user())
# Simple route between 3 stops
stops <- st_sf(
name = c("Start", "Middle", "End"),
geometry = st_sfc(
st_point(c(-122.4194, 37.7749)), # San Francisco
st_point(c(-122.0312, 37.3318)), # Cupertino
st_point(c(-121.8863, 37.3382)), # San Jose
crs = 4326
)
)
resp <- find_routes(stops)
# Route with time windows for deliveries
delivery_stops <- st_sf(
name = c("Warehouse", "Customer A", "Customer B", "Customer C"),
time_window_start = as.POSIXct(c(
"2024-01-15 08:00:00",
"2024-01-15 09:00:00",
"2024-01-15 11:00:00",
"2024-01-15 14:00:00"
)),
time_window_end = as.POSIXct(c(
"2024-01-15 08:30:00",
"2024-01-15 10:00:00",
"2024-01-15 13:00:00",
"2024-01-15 16:00:00"
)),
geometry = st_sfc(
st_point(c(-122.4194, 37.7749)),
st_point(c(-122.4083, 37.7858)),
st_point(c(-122.4313, 37.7793)),
st_point(c(-122.4000, 37.7900)),
crs = 4326
)
)
delivery_route <- find_routes(
delivery_stops,
start_time = as.POSIXct("2024-01-15 08:00:00"),
travel_mode = "Driving Time"
)
# Find optimal order for stops
sales_stops <- st_sf(
name = c("Office", "Client 1", "Client 2", "Client 3", "Office"),
geometry = st_sfc(
st_point(c(-122.4194, 37.7749)),
st_point(c(-122.4083, 37.7858)),
st_point(c(-122.4313, 37.7793)),
st_point(c(-122.4000, 37.7900)),
st_point(c(-122.4194, 37.7749)),
crs = 4326
)
)
optimized_route <- find_routes(
sales_stops,
find_best_sequence = TRUE,
preserve_first_stop = TRUE,
preserve_last_stop = TRUE
)
# Route with barriers
barrier_pts <- st_sfc(
st_point(c(-122.4150, 37.7800)),
crs = 4326
)
route_with_barriers <- find_routes(
stops,
barriers = barrier_pts
)
# Accumulate multiple impedances
multi_impedance_route <- find_routes(
stops,
impedance_attribute_name = "travel_time",
accumulate_attribute_names = c("miles", "kilometers")
)
## End(Not run)
Find Routes (Async)
Description
Submits an asynchronous geoprocessing job to find the best routes between
stops using the ArcGIS /FindRoutes GP service.
Usage
find_routes_job(
stops,
travel_mode = NULL,
measurement_units = NULL,
analysis_region = NULL,
reorder_stops = FALSE,
preserve_terminal_stops = NULL,
return_to_start = NULL,
use_time_windows = NULL,
time_of_day = NULL,
uturn_at_junctions = NULL,
use_hierarchy = NULL,
restrictions = NULL,
impedance = NULL,
time_impedance = NULL,
distance_impedance = NULL,
route_shape = NULL,
populate_route_edges = NULL,
populate_directions = NULL,
directions_language = NULL,
directions_distance_units = NULL,
directions_style_name = NULL,
output_format = "feature_set",
ignore_invalid_locations = TRUE,
point_barriers = NULL,
line_barriers = NULL,
polygon_barriers = NULL,
token = arcgisutils::arc_token()
)
Arguments
stops |
An |
travel_mode |
Character. The name or ID of the travel mode to use.
See |
measurement_units |
Character. Units for reporting total travel time or
distance. One of: |
analysis_region |
Character. Region for the analysis. One of:
|
reorder_stops |
Logical. Reorder stops to find the optimal route
(TSP). Default: |
preserve_terminal_stops |
Character. Which terminal stops to preserve
when |
return_to_start |
Logical. Whether the route should return to its
starting location. Default: |
use_time_windows |
Logical. Whether to honour time windows on stops.
Default: |
time_of_day |
POSIXct. The departure time for the routes. When |
uturn_at_junctions |
Character. U-turn policy at junctions. One of:
|
use_hierarchy |
Logical. Whether to use the street hierarchy when
finding routes. Default: |
restrictions |
Character vector. Restriction names to apply.
Default: |
impedance |
Character. Impedance type. One of: |
time_impedance |
Character. Time-based impedance. One of:
|
distance_impedance |
Character. Distance-based impedance. One of:
|
route_shape |
Character. Shape of the output route features. One of:
|
populate_route_edges |
Logical. Generate edges for each route.
Default: |
populate_directions |
Logical. Generate driving directions.
Default: |
directions_language |
Character. Language code for directions.
Default: |
directions_distance_units |
Character. Units for distances in
directions. One of: |
directions_style_name |
Character. Formatting style for directions.
One of: |
output_format |
Character. Format for output features. One of:
|
ignore_invalid_locations |
Logical. Whether to ignore invalid
input locations. Default: |
point_barriers |
Point barriers as |
line_barriers |
Line barriers as |
polygon_barriers |
Polygon barriers as |
token |
Authorization token. Default: |
Value
A find_routes_job R6 object inheriting from
arcgisutils::arc_gp_job. Call $start() to submit and $results to
retrieve output.
References
See Also
Other async:
download_od_results(),
download_service_area_results(),
find_closest_facilities_job(),
find_service_areas_job(),
last_mile_delivery(),
location_allocation_job(),
od_cost_matrix_job(),
route_vehicles_job()
Other routing:
find_routes()
Examples
## Not run:
# This example is not executed since it requires a network connection
# to ArcGIS Online and a valid authentication token
library(sf)
library(arcgisutils)
set_arc_token(auth_user())
stops <- st_sf(
name = c("Stop 1", "Stop 2", "Stop 3"),
geometry = st_sfc(
st_point(c(145.066, -37.865)),
st_point(c(145.105, -37.819)),
st_point(c(145.120, -37.800)),
crs = 4326
)
)
job <- find_routes_job(stops)
job$start()
result <- job$results
## End(Not run)
Solve Service Area
Description
Solve Service Area
Usage
find_service_areas(
facilities,
default_breaks = c(5, 10, 15),
travel_mode = NULL,
travel_direction = "away",
time_of_day = NULL,
output_polygons = "simplified",
split_polygons_at_breaks = TRUE,
overlap_polygons = TRUE,
merge_similar_polygon_ranges = FALSE,
trim_outer_polygons = TRUE,
output_lines = NULL,
split_lines_at_breaks = TRUE,
overlap_lines = TRUE,
return_geometry = "service_areas",
u_turns = NULL,
use_hierarchy = NULL,
impedance = NULL,
accumulate_impedance = NULL,
restrictions = NULL,
trim_polygon_distance = 100,
trim_polygon_distance_units = "meters",
point_barriers = NULL,
line_barriers = NULL,
polygon_barriers = NULL,
ignore_invalid_locations = TRUE,
output_geometry_precision = 10,
output_geometry_precision_units = "meters",
crs = 4326,
token = arcgisutils::arc_token()
)
Arguments
facilities |
an |
default_breaks |
default |
travel_mode |
Character. The name of the travel mode to use. See
|
travel_direction |
default |
time_of_day |
default |
output_polygons |
default |
split_polygons_at_breaks |
default |
overlap_polygons |
default |
merge_similar_polygon_ranges |
default |
trim_outer_polygons |
default |
output_lines |
default |
split_lines_at_breaks |
default |
overlap_lines |
default |
return_geometry |
default |
u_turns |
default |
use_hierarchy |
Logical. Whether to use hierarchy when finding routes.
Default: |
impedance |
default |
accumulate_impedance |
default |
restrictions |
Character vector. Restriction names to honor.
Default: |
trim_polygon_distance |
default |
trim_polygon_distance_units |
default |
point_barriers |
default |
line_barriers |
default |
polygon_barriers |
Polygon barriers as |
ignore_invalid_locations |
Logical. Whether to ignore invalid locations.
Default: |
output_geometry_precision |
default |
output_geometry_precision_units |
default |
crs |
default |
token |
Authorization token. Default: |
Value
A list containing the service area results.
References
See Also
Other direct:
find_closest_facilities(),
find_routes(),
od_cost_matrix(),
route_vehicles(),
snap_to_roads()
Other service area:
download_service_area_results(),
find_service_areas_job()
Examples
## Not run:
# This example is not executed since it requires a network connection
# to ArcGIS Online and a valid authentication token
library(sf)
library(arcgisutils)
set_arc_token(auth_user())
facility <- st_sfc(st_point(c(-122.253, 37.757)), crs = 4326)
find_service_areas(facility)
## End(Not run)
Generate Service Areas (Async)
Description
Submits an asynchronous geoprocessing job to generate service areas around
facilities using the ArcGIS /GenerateServiceAreas GP service.
Usage
find_service_areas_job(
facilities,
break_values = NULL,
break_units = NULL,
travel_mode = NULL,
travel_direction = NULL,
time_of_day = NULL,
use_hierarchy = NULL,
uturn_at_junctions = NULL,
polygons_for_multiple_facilities = NULL,
polygon_overlap_type = NULL,
detailed_polygons = NULL,
polygon_trim_distance = NULL,
polygon_simplification_tolerance = NULL,
polygon_detail = NULL,
output_type = NULL,
analysis_region = NULL,
restrictions = NULL,
impedance = NULL,
time_impedance = NULL,
distance_impedance = NULL,
ignore_invalid_locations = TRUE,
output_format = "feature_set",
point_barriers = NULL,
line_barriers = NULL,
polygon_barriers = NULL,
token = arcgisutils::arc_token()
)
Arguments
facilities |
An |
break_values |
Numeric vector. Service area sizes. Units are determined
by |
break_units |
Character. Units for |
travel_mode |
Character. The name or ID of the travel mode to use.
See |
travel_direction |
Character. Direction of travel relative to
facilities. One of: |
time_of_day |
POSIXct. The departure time for the routes. When |
use_hierarchy |
Logical. Whether to use the street hierarchy when
finding routes. Default: |
uturn_at_junctions |
Character. U-turn policy at junctions. One of:
|
polygons_for_multiple_facilities |
Character. How service area polygons
from multiple facilities are generated. One of: |
polygon_overlap_type |
Character. Whether polygons are rings or disks.
One of: |
detailed_polygons |
Logical. Generate detailed polygons. Default: |
polygon_trim_distance |
List with elements |
polygon_simplification_tolerance |
List with elements |
polygon_detail |
Character. Level of detail for output polygons. One
of: |
output_type |
Character. Type of output to generate. One of:
|
analysis_region |
Character. Region for the analysis. One of:
|
restrictions |
Character vector. Restriction names to apply.
Default: |
impedance |
Character. Impedance type. One of: |
time_impedance |
Character. Time-based impedance. One of:
|
distance_impedance |
Character. Distance-based impedance. One of:
|
ignore_invalid_locations |
Logical. Whether to ignore invalid input
locations. Default: |
output_format |
Character. Format for output features. One of:
|
point_barriers |
Point barriers as |
line_barriers |
Line barriers as |
polygon_barriers |
Polygon barriers as |
token |
Authorization token. Default: |
Value
A find_service_areas_job R6 object inheriting from
arcgisutils::arc_gp_job. Call $start() to submit and $results to
retrieve output.
References
See Also
Other async:
download_od_results(),
download_service_area_results(),
find_closest_facilities_job(),
find_routes_job(),
last_mile_delivery(),
location_allocation_job(),
od_cost_matrix_job(),
route_vehicles_job()
Other service area:
download_service_area_results(),
find_service_areas()
Examples
## Not run:
# This example is not executed since it requires a network connection
# to ArcGIS Online and a valid authentication token
library(sf)
library(arcgisutils)
set_arc_token(auth_user())
facilities <- st_sfc(
st_point(c(-122.4194, 37.7749)),
st_point(c(-122.0312, 37.3318)),
crs = 4326
)
job <- find_service_areas_job(facilities, break_values = c(5, 10, 15))
job$start()
result <- job$results
## End(Not run)
Get available travel modes
Description
Returns the names of the travel modes supported by the routing services associated with the provided token.
Usage
get_travel_modes(token = arc_token())
Arguments
token |
Authorization token. Default: |
Value
A character vector of supported travel mode names.
Examples
## Not run:
# This example is not executed since it requires a network connection
# to ArcGIS Online and a valid authentication token
library(arcgisutils)
set_arc_token(auth_user())
get_travel_modes()
## End(Not run)
Solve Last Mile Delivery (Async)
Description
Submits an asynchronous geoprocessing job to solve a last-mile delivery
problem using the ArcGIS /SolveLastMileDelivery GP service. Last Mile
Delivery is a specialized vehicle routing problem that creates
geographically clustered delivery routes to minimize fleet operating costs.
Usage
last_mile_delivery(
orders,
depots,
routes = NULL,
order_specialties = NULL,
route_specialties = NULL,
zones = NULL,
travel_mode = NULL,
analysis_region = NULL,
ignore_network_location_fields = FALSE,
ignore_invalid_order_locations = FALSE,
earliest_route_start_date = NULL,
earliest_route_start_time = NULL,
time_zone_usage_for_time_fields = NULL,
max_route_total_time = NULL,
sequence_gap = NULL,
time_units = NULL,
distance_units = NULL,
route_shape = NULL,
populate_directions = FALSE,
directions_language = NULL,
save_route_data = FALSE,
save_output_network_analysis_layer = FALSE,
output_format = "feature_set",
point_barriers = NULL,
line_barriers = NULL,
polygon_barriers = NULL,
token = arcgisutils::arc_token()
)
Arguments
orders |
An |
depots |
An |
routes |
A |
order_specialties |
A |
route_specialties |
A |
zones |
An |
travel_mode |
Character. The name or ID of the travel mode to use.
See |
analysis_region |
Character. Region for the analysis. One of:
|
ignore_network_location_fields |
Logical. Whether network location
fields on the inputs are ignored. Default: |
ignore_invalid_order_locations |
Logical. Whether to ignore invalid
orders instead of failing. Default: |
earliest_route_start_date |
Date. Default earliest start date applied to
routes whose |
earliest_route_start_time |
An |
time_zone_usage_for_time_fields |
Character. Time zone used for all
date-time input fields. One of: |
max_route_total_time |
Numeric. Default maximum allowed total time for
each route, applied to routes whose |
sequence_gap |
Integer. Gap in numerical values to leave in the
|
time_units |
Character. Units for all time-based attribute values. One
of: |
distance_units |
Character. Units for all distance-based attribute
values. One of: |
route_shape |
Character. Geometry type for output route lines. One of:
|
populate_directions |
Logical. Whether to generate driving directions
for each route. Default: |
directions_language |
Character. Language code for directions (e.g.
|
save_route_data |
Logical. Whether to save results as a |
save_output_network_analysis_layer |
Logical. Whether the analysis
settings are saved as a network analysis layer package file. Default:
|
output_format |
Character. Format for output features. One of:
|
point_barriers |
Point barriers as |
line_barriers |
Line barriers as |
polygon_barriers |
Polygon barriers as |
token |
Authorization token. Default: |
Value
A last_mile_delivery_job R6 object inheriting from
arcgisutils::arc_gp_job. Call $start() to submit and $results to
retrieve output.
References
See Also
Other async:
download_od_results(),
download_service_area_results(),
find_closest_facilities_job(),
find_routes_job(),
find_service_areas_job(),
location_allocation_job(),
od_cost_matrix_job(),
route_vehicles_job()
Other vrp:
route_vehicles(),
route_vehicles_job()
Examples
## Not run:
# This example is not executed since it requires a network connection
# to ArcGIS Online and a valid authentication token
library(sf)
library(arcgisutils)
set_arc_token(auth_user())
orders <- st_as_sf(
data.frame(
name = c("Order 1", "Order 2"),
service_time = c(5, 5),
time_window_start = as.POSIXct(
c(NA, 1706860800),
origin = "1970-01-01",
tz = "UTC"
),
time_window_end = as.POSIXct(
c(1706868000, 1706868000),
origin = "1970-01-01",
tz = "UTC"
),
max_violation_time = c(0, 30),
delivery_quantity_1 = c(2000, 1500),
delivery_quantity_2 = c(100, 75),
x = c(-117, -117.5),
y = c(34, 34.5)
),
coords = c("x", "y"),
crs = 4326
)
depots <- st_as_sf(
data.frame(name = "Depot 1", x = -117.2, y = 34.2),
coords = c("x", "y"),
crs = 4326
)
routes <- data.frame(
name = c("Truck 1", "Truck 2"),
start_depot_name = c("Depot 1", "Depot 1"),
end_depot_name = c("Depot 1", "Depot 1"),
earliest_start_time = c("6:00:00", "6:00:00"),
capacity_1 = c(40000, 30000),
capacity_2 = c(2000, 2500),
cost_per_unit_time = c(0.5, 0.5),
cost_per_unit_distance = c(1.5, 1.5)
)
order_specialties <- data.frame(
order_name = c("Order 1", "Order 2"),
specialty_name = c("Refrigerated", "Hazmat")
)
route_specialties <- data.frame(
route_name = c("Truck 1", "Truck 2"),
specialty_name = c("Refrigerated", "Hazmat")
)
zone1 <- st_polygon(list(rbind(
c(-97.0634, 32.8442),
c(-97.0554, 32.84),
c(-97.0558, 32.8327),
c(-97.0638, 32.83),
c(-97.0634, 32.8442)
)))
zone2 <- st_multipolygon(list(
list(rbind(
c(-97.0803, 32.8235),
c(-97.0776, 32.8277),
c(-97.074, 32.8254),
c(-97.0767, 32.8227),
c(-97.0803, 32.8235)
)),
list(rbind(
c(-97.0871, 32.8311),
c(-97.0831, 32.8292),
c(-97.0853, 32.8259),
c(-97.0892, 32.8279),
c(-97.0871, 32.8311)
))
))
zones <- st_cast(
st_sf(
name = c("Zone 1", "Zone 2"),
geometry = st_sfc(zone1, zone2, crs = 4326)
),
"MULTIPOLYGON"
)
job <- last_mile_delivery(
orders = orders,
depots = depots,
routes = routes,
order_specialties = order_specialties,
route_specialties = route_specialties,
zones = zones,
earliest_route_start_date = as.Date("2024-02-02"),
max_route_total_time = 480,
sequence_gap = 3,
time_units = "minutes",
route_shape = "true_shape_with_measures",
populate_directions = TRUE
)
job$start()
job$results
## End(Not run)
Solve Location-Allocation (Async)
Description
Submits an asynchronous geoprocessing job that chooses the set of facilities
which best serve demand from surrounding areas, simultaneously locating
facilities and allocating demand points to them, using the ArcGIS
/SolveLocationAllocation GP service.
Usage
location_allocation_job(
facilities,
demand_points,
travel_mode = NULL,
locate_settings = NULL,
measurement_units = NULL,
analysis_region = NULL,
problem_type = NULL,
number_of_facilities_to_find = NULL,
default_measurement_cutoff = NULL,
default_capacity = NULL,
target_market_share = NULL,
measurement_transformation_model = NULL,
measurement_transformation_factor = NULL,
travel_direction = NULL,
time_of_day = NULL,
uturn_at_junctions = NULL,
use_hierarchy = NULL,
restrictions = NULL,
attribute_parameter_values = NULL,
allocation_line_shape = NULL,
time_impedance = NULL,
distance_impedance = NULL,
impedance = NULL,
point_barriers = NULL,
line_barriers = NULL,
polygon_barriers = NULL,
save_output_network_analysis_layer = NULL,
output_format = "feature_set",
ignore_invalid_locations = TRUE,
token = arcgisutils::arc_token()
)
Arguments
facilities |
An |
demand_points |
An |
travel_mode |
Character. The name or ID of the travel mode to use.
See |
locate_settings |
List. Settings that affect how input data are located,
passed through as a JSON object. Default: |
measurement_units |
Character. Units for reporting total travel time or
distance. One of: |
analysis_region |
Character. Region for the analysis. One of:
|
problem_type |
Character. Objective of the location-allocation analysis.
One of: |
number_of_facilities_to_find |
Integer. The number of facilities the
task should choose. Default: |
default_measurement_cutoff |
Numeric. The maximum travel time or distance
allowed between a demand point and the facility to which it is allocated.
Units are determined by |
default_capacity |
Numeric. The default capacity assigned to all
facilities. Only applicable to the |
target_market_share |
Numeric. The percentage of total demand weight to
capture. Only applicable to the |
measurement_transformation_model |
Character. Equation for transforming
the network cost between facilities and demand points. One of: |
measurement_transformation_factor |
Numeric. The impedance parameter
value (lambda) for |
travel_direction |
Character. Direction in which to measure travel. One
of: |
time_of_day |
POSIXct. The departure time for the routes. When |
uturn_at_junctions |
Character. U-turn policy at junctions. One of:
|
use_hierarchy |
Logical. Whether to use the street hierarchy when
finding routes. Default: |
restrictions |
Character vector. Restriction names to apply.
Default: |
attribute_parameter_values |
List. Additional values for attributes or restrictions, passed through as a JSON object. Default: |
allocation_line_shape |
Character. Type of line features output by the
request. One of: |
time_impedance |
Character. Time-based impedance. One of:
|
distance_impedance |
Character. Distance-based impedance. One of:
|
impedance |
Character. Impedance type. One of: |
point_barriers |
Point barriers as |
line_barriers |
Line barriers as |
polygon_barriers |
Polygon barriers as |
save_output_network_analysis_layer |
Logical. Whether to save the analysis as a network analysis layer package file. Default: |
output_format |
Character. Format for output features. One of:
|
ignore_invalid_locations |
Logical. Whether to ignore invalid
input locations. Default: |
token |
Authorization token. Default: |
Value
A location_allocation_job R6 object inheriting from
arcgisutils::arc_gp_job. Call $start() to submit and $results to
retrieve output.
References
See Also
Other async:
download_od_results(),
download_service_area_results(),
find_closest_facilities_job(),
find_routes_job(),
find_service_areas_job(),
last_mile_delivery(),
od_cost_matrix_job(),
route_vehicles_job()
Examples
## Not run:
# This example is not executed since it requires a network connection
# to ArcGIS Online and a valid authentication token
library(sf)
library(arcgisutils)
set_arc_token(auth_user())
facilities <- st_sf(
name = c("Facility A", "Facility B"),
facility_type = c(0L, 0L),
curb_approach = c(0L, 0L),
geometry = st_sfc(
st_point(c(-58.557329417999938, -34.587693706999971)),
st_point(c(-58.460247408999976, -34.683348039999942)),
crs = 4326
)
)
demand_points <- st_sf(
name = c("Household 4", "Household 3", "Household 2", "Household 1"),
group_name = c("A", "A", NA, NA),
weight = c(2, 2, 3, 5),
curb_approach = c(0L, 0L, 0L, 1L),
geometry = st_sfc(
st_point(c(-58.664405163999959, -34.614819562999969)),
st_point(c(-58.514499119999982, -34.496322404999944)),
st_point(c(-58.54162497599998, -34.788996107999935)),
st_point(c(-58.40599569799997, -34.637662387999967)),
crs = 4326
)
)
job <- location_allocation_job(facilities, demand_points)
job$start()
result <- job$results
## End(Not run)
Origin-Destination Cost Matrix
Description
Creates an origin-destination cost matrix containing the travel cost between every origin and destination.
Usage
od_cost_matrix(
origins,
destinations = origins,
travel_mode = NULL,
default_cutoff = NULL,
default_target_destination_count = NULL,
output_type = NULL,
time_of_day = NULL,
u_turns = NULL,
use_hierarchy = NULL,
impedance = NULL,
accumulate_impedance = NULL,
restrictions = NULL,
attribute_parameter_values = NULL,
point_barriers = NULL,
line_barriers = NULL,
polygon_barriers = NULL,
return_geometry = character(0),
ignore_invalid_locations = TRUE,
return_empty_results = FALSE,
geometry_precision = NULL,
locate_settings = NULL,
crs = 4326,
token = arcgisutils::arc_token()
)
Arguments
origins |
an |
destinations |
default |
travel_mode |
Character. The name of the travel mode to use. See
|
default_cutoff |
default |
default_target_destination_count |
default |
output_type |
default |
time_of_day |
default |
u_turns |
default |
use_hierarchy |
Logical. Whether to use hierarchy when finding routes.
Default: |
impedance |
default |
accumulate_impedance |
default |
restrictions |
Character vector. Restriction names to honor.
Default: |
attribute_parameter_values |
default |
point_barriers |
default |
line_barriers |
default |
polygon_barriers |
Polygon barriers as |
return_geometry |
default |
ignore_invalid_locations |
Logical. Whether to ignore invalid locations.
Default: |
return_empty_results |
default |
geometry_precision |
default |
locate_settings |
default |
crs |
default |
token |
Authorization token. Default: |
Value
A named list. Elements present depend on return_geometry and output_type:
-
od_cost_matrix: nested cost matrix returned whenoutput_type = "sparse_matrix". A list withcostAttributeNamesand, per origin ID, a list mapping destination ID to its cost values. -
od_lines: OD cost matrix features -
origins: origin features -
destinations: destination features -
barriers: point barrier features -
polyline_barriers: polyline barrier features -
polygon_barriers: polygon barrier features -
messages: status and warning messages from the service
References
See Also
Other direct:
find_closest_facilities(),
find_routes(),
find_service_areas(),
route_vehicles(),
snap_to_roads()
Other od:
download_od_results(),
od_cost_matrix_job()
Examples
## Not run:
# This example is not executed since it requires a network connection
# to ArcGIS Online and a valid authentication token
library(sf)
library(arcgisutils)
set_arc_token(auth_user())
origins <- st_sfc(
st_point(c(-122.4194, 37.7749)),
st_point(c(-122.4313, 37.7793)),
crs = 4326
)
destinations <- st_sfc(
st_point(c(-122.4083, 37.7858)),
st_point(c(-122.4000, 37.7900)),
st_point(c(-122.4561, 37.7513)),
crs = 4326
)
result <- od_cost_matrix(
origins = origins,
destinations = destinations
)
result
## End(Not run)
Generate Origin-Destination Cost Matrix (Async)
Description
Submits an asynchronous geoprocessing job that creates an origin-destination
(OD) cost matrix from multiple origins to multiple destinations using the
ArcGIS /GenerateOriginDestinationCostMatrix GP service. The matrix reports
the travel time or travel distance from every origin to every destination.
Usage
od_cost_matrix_job(
origins,
destinations = NULL,
travel_mode = NULL,
time_units = NULL,
distance_units = NULL,
analysis_region = NULL,
n_dests = NULL,
cutoff = NULL,
time_of_day = NULL,
uturn_at_junctions = NULL,
use_hierarchy = NULL,
restrictions = NULL,
attribute_parameter_values = NULL,
origin_destination_line_shape = NULL,
impedance = NULL,
time_impedance = NULL,
distance_impedance = NULL,
point_barriers = NULL,
line_barriers = NULL,
polygon_barriers = NULL,
save_output_network_analysis_layer = NULL,
output_format = "feature_set",
ignore_invalid_locations = TRUE,
token = arcgisutils::arc_token()
)
Arguments
origins |
An |
destinations |
An |
travel_mode |
Character. The name or ID of the travel mode to use.
See |
time_units |
Character. Units used to measure and report the total
travel time between each origin-destination pair. One of: |
distance_units |
Character. Units used to measure and report the total
travel distance between each origin-destination pair. One of: |
analysis_region |
Character. Region for the analysis. One of:
|
n_dests |
Integer. The maximum number of destinations to find per
origin. Default: |
cutoff |
Numeric. The travel time or travel distance value at which to
stop searching for destinations from a given origin. Default: |
time_of_day |
POSIXct. The departure time for the routes. When |
uturn_at_junctions |
Character. U-turn policy at junctions. One of:
|
use_hierarchy |
Logical. Whether to use the street hierarchy when
finding routes. Default: |
restrictions |
Character vector. Restriction names to apply.
Default: |
attribute_parameter_values |
List. Additional values for attributes or restrictions, passed through as a JSON object. Default: |
origin_destination_line_shape |
Character. Shape of the line feature
connecting each origin-destination pair in the output matrix. One of:
|
impedance |
Character. Impedance type. One of: |
time_impedance |
Character. Time-based impedance. One of:
|
distance_impedance |
Character. Distance-based impedance. One of:
|
point_barriers |
Point barriers as |
line_barriers |
Line barriers as |
polygon_barriers |
Polygon barriers as |
save_output_network_analysis_layer |
Logical. Whether to save the analysis as a network analysis layer package file. Default: |
output_format |
Character. Format for output features. One of:
|
ignore_invalid_locations |
Logical. Whether to ignore invalid
input locations. Default: |
token |
Authorization token. Default: |
Value
An od_cost_matrix_job R6 object inheriting from
arcgisutils::arc_gp_job. Call $start() to submit and $results to
retrieve output.
References
See Also
Other async:
download_od_results(),
download_service_area_results(),
find_closest_facilities_job(),
find_routes_job(),
find_service_areas_job(),
last_mile_delivery(),
location_allocation_job(),
route_vehicles_job()
Other od:
download_od_results(),
od_cost_matrix()
Examples
## Not run:
# This example is not executed since it requires a network connection
# to ArcGIS Online and a valid authentication token
library(sf)
library(arcgisutils)
set_arc_token(auth_user())
origins <- st_sf(
name = c("Origin 1", "Origin 2"),
n_dests = c(2L, 3L),
cutoff = c(120, 90),
curb_approach = c(0L, 0L),
geometry = st_sfc(
st_point(c(-0.1891, 51.5254)),
st_point(c(-0.1744, 51.5353)),
crs = 4326
)
)
destinations <- st_sf(
name = c("Destination 1", "Destination 2"),
curb_approach = c(0L, 0L),
geometry = st_sfc(
st_point(c(-0.1991, 51.5354)),
st_point(c(-0.1844, 51.5458)),
crs = 4326
)
)
job <- od_cost_matrix_job(origins, destinations)
job$start()
result <- job$results
## End(Not run)
Route Vehicles
Description
Solves a vehicle routing problem (VRP) to find the most effective routes for a fleet of vehicles visiting a set of orders.
Usage
route_vehicles(
orders,
depots,
routes = NULL,
travel_mode = NULL,
locate_settings = NULL,
analysis_region = NULL,
time_zone_usage_for_time_fields = NULL,
default_date = NULL,
breaks = NULL,
time_units = NULL,
distance_units = NULL,
time_window_factor = NULL,
spatially_cluster_routes = TRUE,
route_zones = NULL,
route_renewals = NULL,
order_pairs = NULL,
excess_transit_factor = NULL,
uturn_policy = NULL,
point_barriers = NULL,
line_barriers = NULL,
polygon_barriers = NULL,
use_hierarchy_in_analysis = TRUE,
restrictions = NULL,
attribute_parameter_values = NULL,
time_impedance = NULL,
distance_impedance = NULL,
impedance = NULL,
populate_route_lines = TRUE,
route_line_simplification_tolerance = NULL,
populate_directions = FALSE,
directions_language = NULL,
directions_style_name = NULL,
save_route_data = FALSE,
save_output_layer = FALSE,
populate_stop_shapes = FALSE,
ignore_invalid_order_locations = FALSE,
token = arcgisutils::arc_token()
)
Arguments
orders |
an |
depots |
an |
routes |
default |
travel_mode |
Character. The name of the travel mode to use. See
|
locate_settings |
default |
analysis_region |
default |
time_zone_usage_for_time_fields |
default |
default_date |
default |
breaks |
default |
time_units |
default |
distance_units |
default |
time_window_factor |
default |
spatially_cluster_routes |
default |
route_zones |
default |
route_renewals |
default |
order_pairs |
default |
excess_transit_factor |
default |
uturn_policy |
default |
point_barriers |
default |
line_barriers |
default |
polygon_barriers |
Polygon barriers as |
use_hierarchy_in_analysis |
default |
restrictions |
Character vector. Restriction names to honor.
Default: |
attribute_parameter_values |
default |
time_impedance |
default |
distance_impedance |
default |
impedance |
default |
populate_route_lines |
default |
route_line_simplification_tolerance |
default |
populate_directions |
default |
directions_language |
default |
directions_style_name |
default |
save_route_data |
default |
save_output_layer |
default |
populate_stop_shapes |
default |
ignore_invalid_order_locations |
default |
token |
Authorization token. Default: |
Value
A named list:
-
unassigned_stops: orders that could not be assigned to any route -
stops: assigned stop features with route and sequence information -
routes: route features with geometry and cost attributes -
directions: driving directions (only whenpopulate_directions = TRUE) -
solve_succeeded: logical indicating whether the solve completed -
usage_cost: list withnumObjectsandcreditsused -
messages: status and warning messages from the service
References
See Also
Other direct:
find_closest_facilities(),
find_routes(),
find_service_areas(),
od_cost_matrix(),
snap_to_roads()
Other vrp:
last_mile_delivery(),
route_vehicles_job()
Examples
## Not run:
# This example is not executed since it requires a network connection
# to ArcGIS Online and a valid authentication token
library(sf)
library(arcgisutils)
set_arc_token(auth_user())
orders <- st_sf(
name = c("Order 1", "Order 2"),
geometry = st_sfc(
st_point(c(-0.1891, 51.5254)),
st_point(c(-0.1744, 51.5353)),
crs = 4326
)
)
depots <- st_sf(
name = "Depot1",
geometry = st_sfc(st_point(c(-0.2, 51.5)), crs = 4326)
)
routes <- data.frame(
name = "Truck1",
start_depot_name = "Depot1",
end_depot_name = "Depot1",
capacities = "40000"
)
result <- route_vehicles(orders, depots, routes)
## End(Not run)
Solve Vehicle Routing Problem (Async)
Description
Submits an asynchronous geoprocessing job to solve a vehicle routing problem
using the ArcGIS /SolveVehicleRoutingProblem GP service.
Usage
route_vehicles_job(
orders,
depots,
routes = NULL,
breaks = NULL,
travel_mode = NULL,
analysis_region = NULL,
time_zone_usage_for_time_fields = NULL,
default_date = NULL,
time_units = NULL,
distance_units = NULL,
time_window_factor = NULL,
spatially_cluster_routes = TRUE,
route_zones = NULL,
route_renewals = NULL,
order_pairs = NULL,
excess_transit_factor = NULL,
uturn_policy = NULL,
restrictions = NULL,
impedance = NULL,
time_impedance = NULL,
distance_impedance = NULL,
use_hierarchy_in_analysis = TRUE,
populate_route_lines = TRUE,
route_line_simplification_tolerance = NULL,
populate_directions = FALSE,
directions_language = NULL,
directions_style_name = NULL,
save_route_data = FALSE,
save_output_layer = FALSE,
populate_stop_shapes = FALSE,
output_format = "feature_set",
ignore_invalid_order_locations = FALSE,
point_barriers = NULL,
line_barriers = NULL,
polygon_barriers = NULL,
token = arcgisutils::arc_token()
)
Arguments
orders |
An |
depots |
An |
routes |
A |
breaks |
A |
travel_mode |
Character. The name or ID of the travel mode to use.
See |
analysis_region |
Character. Region for the analysis. One of:
|
time_zone_usage_for_time_fields |
Character. Time zone used for all
date-time input fields. One of: |
default_date |
POSIXct. The date on which all routes start. Only the
date portion is used. Default: |
time_units |
Character. Units for all time-based attribute values. One
of: |
distance_units |
Character. Units for all distance-based attribute
values. One of: |
time_window_factor |
Character. Importance of honoring time windows.
One of: |
spatially_cluster_routes |
Logical. Whether orders assigned to a route
are spatially clustered. Default: |
route_zones |
An |
route_renewals |
A |
order_pairs |
A |
excess_transit_factor |
Character. Importance of reducing excess transit
time for order pairs. One of: |
uturn_policy |
Character. U-turn policy at junctions. One of:
|
restrictions |
Character vector. Restriction names to apply.
Default: |
impedance |
Character. Impedance type. One of: |
time_impedance |
Character. Time-based impedance. One of:
|
distance_impedance |
Character. Distance-based impedance. One of:
|
use_hierarchy_in_analysis |
Logical. Whether to use the street network
hierarchy when finding routes. Default: |
populate_route_lines |
Logical. Whether output routes include the exact
street shape. Default: |
route_line_simplification_tolerance |
Numeric. Simplification tolerance
for route geometry. Default: |
populate_directions |
Logical. Whether to generate driving directions
for each route. Default: |
directions_language |
Character. Language code for directions (e.g.
|
directions_style_name |
Character. Formatting style for directions. One
of: |
save_route_data |
Logical. Whether to save results as a |
save_output_layer |
Logical. Whether to save the analysis as a network
analysis layer package. Default: |
populate_stop_shapes |
Logical. Whether output stops include point
geometries. Default: |
output_format |
Character. Format for output features. One of:
|
ignore_invalid_order_locations |
Logical. Whether to ignore invalid
orders instead of failing. Default: |
point_barriers |
Point barriers as |
line_barriers |
Line barriers as |
polygon_barriers |
Polygon barriers as |
token |
Authorization token. Default: |
Value
A route_vehicles_job R6 object inheriting from
arcgisutils::arc_gp_job. Call $start() to submit and $results to
retrieve output.
References
See Also
Other async:
download_od_results(),
download_service_area_results(),
find_closest_facilities_job(),
find_routes_job(),
find_service_areas_job(),
last_mile_delivery(),
location_allocation_job(),
od_cost_matrix_job()
Other vrp:
last_mile_delivery(),
route_vehicles()
Examples
## Not run:
# This example is not executed since it requires a network connection
# to ArcGIS Online and a valid authentication token
library(sf)
library(arcgisutils)
set_arc_token(auth_user())
orders <- st_sf(
name = c("Order 1", "Order 2"),
geometry = st_sfc(
st_point(c(-0.1891, 51.5254)),
st_point(c(-0.1744, 51.5353)),
crs = 4326
)
)
depots <- st_sf(
name = "Depot1",
geometry = st_sfc(st_point(c(-0.2, 51.5)), crs = 4326)
)
job <- route_vehicles_job(orders, depots)
job$start()
result <- job$results
## End(Not run)
Snap Points to Roads
Description
Snaps a set of GPS points to the most likely roads traveled and optionally
returns the traversed road segments as lines using the ArcGIS /SnapToRoads
service.
Usage
snap_to_roads(
points,
travel_mode = NULL,
point_properties = c("oid_routing_streets", "posted_speed_limit_kph",
"posted_speed_limit_mph", "posted_speed_limit_mps", "posted_truck_speed_limit_kph",
"posted_truck_speed_limit_mph", "posted_truck_speed_limit_mps"),
line_properties = c("oid_routing_streets", "length_kilometers", "length_miles",
"posted_speed_limit_kph", "posted_speed_limit_mph", "posted_speed_limit_mps",
"posted_truck_speed_limit_kph", "posted_truck_speed_limit_mph",
"posted_truck_speed_limit_mps"),
analysis_region = c("europe", "japan", "korea", "middleastandafrica", "northamerica",
"southamerica", "southasia", "thailand"),
return_lines = TRUE,
token = arc_token()
)
Arguments
points |
An |
travel_mode |
Character. The name of the travel mode to use. See
|
point_properties |
Character vector. Road properties returned on the
snapped points output. One or more of: |
line_properties |
Character vector. Road properties returned on the
output lines. One or more of: |
analysis_region |
Character. Region in which to perform the analysis. One
of: |
return_lines |
Logical. Whether to return output lines representing the
roads traversed. Default: |
token |
Authorization token. Default: |
Value
A named list:
-
snapped_points: the input points snapped to the road network -
snap_lines: the traversed road segments (only whenreturn_lines = TRUE) -
usage_cost: list withnumObjectsandcreditsused -
messages: status and warning messages from the service
References
See Also
Other direct:
find_closest_facilities(),
find_routes(),
find_service_areas(),
od_cost_matrix(),
route_vehicles()
Examples
## Not run:
# This example is not executed since it requires a network connection
# to ArcGIS Online and a valid authentication token
library(sf)
library(arcgisutils)
set_arc_token(auth_user())
pts <- st_sfc(
st_point(c(-122.43410, 37.80016)),
st_point(c(-122.43460, 37.80074)),
st_point(c(-122.43539, 37.80096)),
crs = 4326
)
snap_to_roads(pts)
## End(Not run)