mb_isochrone | R Documentation |
This function returns isochrones from the Mapbox Navigation Service
Isochrone API. Isochrones are
shapes that represent the reachable area around one or more locations within
a given travel time. Isochrones can be computed for driving, walking, or
cycling routing profiles, and can optionally be set to return distances
rather than times. mb_isochrone()
returns isochrones as simple
features objects in the WGS 1984 geographic coordinate system.
mb_isochrone(
location,
profile = "driving",
time = c(5, 10, 15),
distance = NULL,
depart_at = NULL,
access_token = NULL,
denoise = 1,
generalize = NULL,
geometry = "polygon",
output = "sf",
rate_limit = 300,
keep_color_cols = FALSE,
id_column = NULL
)
location |
A vector of form |
profile |
One of "driving", "walking", "cycling", or "driving-traffic". "driving" is the default. |
time |
A vector of isochrone contours, specified in minutes. Defaults to |
distance |
A vector of distance contours specified in meters. If supplied, will supercede
any call to the |
depart_at |
(optional) For the "driving" or "driving-traffic" profiles, the departure date and time to reflect historical traffic patterns. If "driving-traffic" is used, live traffic will be mixed in with historical traffic for dates/times near to the current time. Should be specified as an ISO 8601 date/time, e.g. |
access_token |
A valid Mapbox access token. |
denoise |
A floating-point value between 0 and 1 used to remove smaller contours. 1 is the default and returns only the largest contour for an input time. |
generalize |
A value expressed in meters of the tolerance for the Douglas-Peucker generalization algorithm used to simplify the isochrone shapes. If |
geometry |
one of |
output |
one of |
rate_limit |
The rate limit for the API, expressed in maximum number of calls per minute. For most users this will be 300 though this parameter can be modified based on your Mapbox plan. Used when |
keep_color_cols |
Whether or not to retain the color columns that the Mapbox API generates by default (applies when the output is an |
id_column |
If the input dataset is an |
An sf
object representing the isochrone(s) around the location(s).
## Not run:
library(mapboxapi)
library(mapdeck)
isochrones <- mb_isochrone("The Kremlin, Moscow Russia",
time = c(4, 8, 12),
profile = "walking"
)
mapdeck(style = mapdeck_style("light")) %>%
add_polygon(
data = isochrones,
fill_colour = "time",
fill_opacity = 0.5,
legend = TRUE
)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.