maptypes: Get supported map types or add new map types

maptypesR Documentation

Get supported map types or add new map types

Description

These functions manage map types.

Usage

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)

Arguments

map_service

character.

  • for get_maptypes(): optional, either "osm", "osm_stamen", "osm_stadia", "osm_thunderforest", "carto", "mapbox", "esri" or "maptiler". Otherwise, a list of map types for both services is returned.

  • for add_maptypes(): character, name of map service the map type to add belongs to

as_df

logical, whether to return a data.frame instead of a list (defaults to FALSE)

url_cols

logical, whether to include the endpoint URL and auxiliary URL columns (defults to FALSE). Ignored, if as_df = FALSE

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 NA). Run get_maptypes(as_df = T, url_cols = T)$url_map_token for examples.

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 NA).

file

character, file name ending on ".csv" that the map types table is saved to or loaded from.

Details

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.

Value

A character vector of supported map types

Source

"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)

See Also

basemap

Examples

# 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"
)


16EAGLE/basemaps documentation built on Nov. 25, 2024, 10:15 a.m.