Draws an interactive leaflet map of one site and its drive-time areas
(isochrones), the areas reachable from the site within each drive time.
It is the first of the four maps that cacs_plot_site_pipeline()
builds.
Usage
cacs_plot_site_isochrone(
site_id = NULL,
lat = NULL,
lon = NULL,
site_name = NULL,
iso_sf,
sites_df = NULL,
tiles = "OpenStreetMap",
padding_km = 5,
...
)Arguments
- site_id
A string giving the
site_idof the site to map, used to find its point insites_dfand its drive-time areas iniso_sf.- lat, lon
Single numbers giving the latitude and longitude of a point in degrees (WGS 84), used when
site_idisNULL. Both must be given. The point is marked at that location, and the areas of every site iniso_sfare used.- site_name
A string giving the name of the site, compared with the
site_namecolumn ofsites_dfincluding case, and used whensite_id,lat, andlonareNULL. It must match one row.- iso_sf
An
sfobject of drive-time areas in EPSG:4326 (longitude and latitude), such as the result ofcacs_isochrone(), with the columnssite_idanddrive_time_min.- sites_df
An
sfobject of site points in longitude and latitude with asite_idcolumn, orNULL(the default) forcacs_alabama_sites. The bundled filelegacy_2025_isochrones.rdsuses the samesite_idvalues for other places, so with its areas the default puts the point and the initial view far from them.- tiles
A string naming the background map, one of the tile providers in
leaflet::providers; the default is"OpenStreetMap", the standard OpenStreetMap map, which needs no API key. The map is built offline, and the tiles are downloaded when it is displayed. The CARTO tiles, such as"CartoDB.Positron", need an API key, which these functions do not send, so they show a notice asking for one.- padding_km
A single positive number. The initial view shows at least this many kilometers on each side of the site; the default is 5.
- ...
Not used. Any argument given here is ignored.
Details
The site is drawn as a point. Each drive time in the drive_time_min
column of iso_sf has its own color, shown in a legend; without that
column, all the areas are drawn in one color.
See also
vignette("visual-walkthrough", package = "catchmentACS")
(https://joonho112.github.io/catchmentACS/articles/visual-walkthrough.html)
builds all four maps for one site, one section each.
Other maps of one site:
cacs_plot_site_intersection(),
cacs_plot_site_pipeline(),
cacs_plot_site_rates(),
cacs_plot_site_weighted(),
format.cacs_site_plot_pipeline(),
print.cacs_site_plot_pipeline()
Examples
if (requireNamespace("leaflet", quietly = TRUE)) {
# Example data bundled with the package for one site in Birmingham,
# Alabama: a 10-minute drive-time area from the OSRM routing service,
# 2019-2023 ACS estimates for nearby tracts, and the cacs_run() result.
fx <- readRDS(system.file("extdata", "visual_walkthrough_fixture.rds",
package = "catchmentACS"))
cacs_plot_site_isochrone(site_id = "AL_BHM_01", iso_sf = fx$iso_sf,
sites_df = fx$sites_df)
}