maptypes | R Documentation |
These functions manage map types.
get_maptypes(map_service = NULL, as_df = FALSE, url_cols = FALSE)
add_maptypes(
map_service,
map_type,
url_endpoint,
url_xy = "xy",
url_file_format = ".png",
url_map_token = as.character(NA),
auth_error_code = 401,
url_website = as.character(NA)
)
save_maptypes(file)
load_maptypes(file)
map_service |
character.
|
as_df |
logical, whether to return a data.frame instead of a list (defaults to |
url_cols |
logical, whether to include the endpoint URL and auxiliary URL columns (defults to |
map_type |
character, name of map type to add |
url_endpoint |
character, endpoint URL for map service and type to add |
url_xy |
character, either "xy" or "yx" defining the order the map service to add is expecting tile subscripts in (defaults to "xy") |
url_file_format |
character, file format the endpoint to add is using (defaults to ".png"). |
url_map_token |
character, optional, request query string used by the endpoint to add for transmitting authentification tokens if required (defaults to |
auth_error_code |
numeric, http error code the endpoint to add uses if authentification failed (defaults to 401) |
url_website |
character, optional, website URL for the service to add the user is directed to for registering (defaults to |
file |
character, file name ending on ".csv" that the map types table is saved to or loaded from. |
get_maptypes()
returns every supported map type that can be used as input to the map_type
argument of set_defaults
, basemap
or associated functions.
add_maptypes()
adds custom user-defined map types.
save_maptypes()
saves the current map types table (as printed by get_maptypes(as_df = T, url_cols = T)
) to a file.
load_maptypes()
loads a map types table from file.
A character vector of supported map types
"osm"
: Open Street Map contributors (https://www.openstreetmap.org/copyright), Open Topo Map (https://opentopomap.org/)
"osm_stamen"
: Stamen (https://maps.stamen.com/) via Stadia Maps (https://stadiamaps.com/), Open Street Map contributors (https://www.openstreetmap.org/copyright)
"osm_stadia"
: Stadia Maps (https://stadiamaps.com/), Open Street Map contributors (https://www.openstreetmap.org/copyright)
"osm_thunderforest"
: Thunderforest (https://www.thunderforest.com/), Open Street Map contributors (https://www.openstreetmap.org/copyright)
"carto"
: Carto (https://carto.com/)
"mapbox"
: Mapbox (https://www.mapbox.com)
"esri"
: Esri (https://www.esri.com/en-us/home)
"maptiler"
: Esri (https://www.maptiler.com)
basemap
# for all services, as list (default:)
get_maptypes()
# for osm only
get_maptypes("osm")
# or
get_maptypes()$osm
# for mapbox only
get_maptypes("mapbox")
# or
get_maptypes()$mapbox
# same for all other map services
# or as data.frame:
get_maptypes(as_df = TRUE)
# or as data.frame including all url columns (endpoints):
get_maptypes(as_df = TRUE, url_cols = TRUE)
# add a custom map service and type yourself:
add_maptypes(
map_service = "someservice", map_type = "terrain",
url_endpoint = "https://tile.someservice.org")
# control further aspects of a custom map service and type:
add_maptypes(
map_service = "someservice", map_type = "terrain",
url_endpoint = "https://tile.someservice.org",
url_xy = "xy", # order in which this service expects tile x and y id
url_file_format = ".png",
url_map_token = "?authtoken=", # query params for auth token
auth_error_code = 401,
url_website = "https://someservice.org"
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.