Description Usage Arguments Value Examples
Functions for retrieving isochrone polygons from the Targomo API and adding
drawing them on a leaflet
map.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | getTargomoPolygons(source_data = NULL, source_lat = NULL,
source_lng = NULL, options = targomoOptions(),
api_key = Sys.getenv("TARGOMO_API_KEY"),
region = Sys.getenv("TARGOMO_REGION"), config = list(),
verbose = FALSE, progress = FALSE, timeout = NULL)
drawTargomoPolygons(map, polygons, drawOptions = polygonDrawOptions(),
group = NULL, ...)
addTargomoPolygons(map, source_data = NULL, source_lng = NULL,
source_lat = NULL, options = targomoOptions(),
drawOptions = polygonDrawOptions(), group = NULL, ...,
api_key = Sys.getenv("TARGOMO_API_KEY"),
region = Sys.getenv("TARGOMO_REGION"), config = list(),
verbose = FALSE, progress = FALSE, timeout = NULL)
|
source_data |
The data object from which source ppoints are derived. |
source_lng, source_lat |
Vectors/one-sided formulas of longitude and latitude. |
options |
A list of |
api_key |
Your Targomo API key - defaults to the |
region |
Your Targomo region - defaults to the |
config |
Config options to pass to |
verbose |
Whether to print out information about the API call. |
progress |
Whether to show a progress bar of the API call. |
timeout |
Timeout in seconds (leave NULL for no timeout/curl default). |
map |
A leaflet map. |
polygons |
A polygons dataset returned by |
drawOptions |
A list of |
group |
The leaflet map group to add the polygons to. A single group is used for all the polygons added by one API call. |
... |
Further arguments to pass to |
For 'get*', an object of class "sf" containing the polygons. For 'draw*' and 'add*', the leaflet map returned with the polygons drawn on.
1 2 3 4 5 6 7 8 9 10 11 12 | # load leaflet package
library(leaflet)
l <- leaflet()
# get the polygons
p <- getTargomoPolygons(source_lat = 51.5007, source_lng = -0.1246,
options = targomoOptions(travelType = "bike"))
# draw them on the map
l %>% drawTargomoPolygons(polygons = p, group = "BigBenBike")
# note could combine get... and draw... into one with add...
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.