Learn R Programming

mapSpain (version 0.1.2)

esp_getTiles: Get Tiles from Public Administrations of Spanish.

Description

Get static map tiles based on a spatial object. Maps can be fetched from various open map servers.

This function is a implementation of the javascript plugin leaflet-providersESP v1.2.0

Usage

esp_getTiles(
  x,
  type = "IDErioja",
  zoom = NULL,
  crop = TRUE,
  res = 512,
  bbox_expand = 0.05,
  transparent = TRUE,
  mask = FALSE,
  update_cache = FALSE,
  cache_dir = NULL,
  verbose = FALSE
)

Arguments

x

An sf object.

type

Name of the provider. See leaflet.providersESP.df.

zoom

the zoom level. If NULL, it is determined automatically (see getTiles). Only valid for WMTS.

crop

TRUE if results should be cropped to the specified x extent, FALSE otherwise. If x is an sf object with one POINT, crop is set to FALSE.

res

Resolution (in pixels) of the final tile. Only valid for WMS.

bbox_expand

A numeric value that indicates the expansion percentage of the bounding box of x.

transparent

Logical. Provides transparent background, if supported. Depends on the selected provider on type.

mask

TRUE if the result should be masked to x.

update_cache, cache_dir, verbose

Value

A RasterBrick is returned.

Details

Results of esp_getTiles could be plotted using tilesLayer

For a complete list of providers see leaflet.providersESP.df.

Most WMS/WMTS providers provide tiles on EPSG:3857. In case that the tile looks deformed, try projecting first x:

x <- sf::st_transform(x,3857)

Tiles are cached under the path cache_dir/[type]

See Also

leaflet.providersESP.df, addProviderEspTiles, getTiles, tilesLayer.