ch_get_map_base {CSHShydRology} | R Documentation |
Prepares for mapping by acquiring the base map and ancillary data: boundaries and rivers. The maps are obtained using OpenStreetMap::openmap which originally accessed the following map types: "osm", "osm-bw", "maptoolkit-topo", "waze", "bing", "stamen-toner", "stamen-terrain", "stamen-watercolor", "osm-german", "osm-wanderreitkarte", "mapbox", "esri", "esri-topo", "nps", "apple-iphoto", "skobbler", "hillshade", "opencyclemap", "osm-transport", "osm-public-transport", "osm-bbike", "osm-bbike-german".
In April 2022 access all of these failed, limiting the available maps to: one of "osm", "bing", "stamen-toner", "stamen-terrain", "stamen-watercolor", "apple-iphoto", "opencyclemap", "osm-transport", "osm-public-transport".
In January 2023, ne_download failed as it produced an incorrect url.
Access to "nps" [default] was added as a work around until OpenstreetMap is updated.
"nps": This layer presents the U.S. National Park Service (NPS) Natural Earth physical map at 1.24km per pixel for the world and 500m for the coterminous United States.
ch_get_map_base(
maplat,
maplong,
map_proj = NA,
map_directory = ".",
map_type = "nps"
)
maplat |
vector of latitudes (2) |
maplong |
vector of longitudes (2) |
map_proj |
map projection currently NA/"latlong" or "albers"/"equalarea" |
map_directory |
directory where map data will be stored; will be created if it does not exist. |
map_type |
map type: select one of osm, bing, stamen-toner, stamen-terrain, stamen-watercolor, apple-iphoto, opencyclemap, osm-transport, osm-public-transport, nps [default], |
Returns a list containing:
map data directory
provincial and state boundaries
rivers and lakes
projection used
bottom and top latitudes
east and west longitudes
Paul Whitfield
# Note: example not tested automatically as it is very slow to execute due to the downloading
latitude <- c(48.0, 61.0)
longitude <- c(-110.0, -128.5)
mapdir <- tempdir()
# get map data
m_map <- ch_get_map_base(latitude,longitude,
map_proj = "Albers",
map_directory = mapdir,
map_type = "nps")