get_tiles {ceramic}R Documentation

Download Mapbox imagery tiles

Description

Obtain imagery or elevation tiles by location query. The first argument loc may be a spatial object (sp, raster, sf) or a 2-column matrix with a single longitude and latitude value. Use buffer to define a width and height to pad around the raw longitude and latitude in metres. If loc has an extent, then buffer is ignored.

Usage

get_tiles(x, buffer, type = "mapbox.satellite", crop_to_buffer = TRUE,
  format = NULL, ..., zoom = NULL, debug = FALSE, max_tiles = NULL,
  base_url = NULL, verbose = TRUE)

Arguments

x

a longitude, latitude pair of coordinates, or a spatial object

buffer

width in metres to extend around the location, ignored if 'x' is a spatial object with extent

type

character string of provider imagery type (see Details)

crop_to_buffer

crop to the user extent, used for creation of output objects (otherwise is padded tile extent)

format

tile format to use, defaults to "jpg" for Mapbox satellite imagery and "png" otherwise

...

arguments passed to internal function, specifically base_url (see Details)

zoom

desired zoom for tiles, use with caution - if NULL is chosen automatically

debug

optionally print out files that will be used

max_tiles

maximum number of tiles - if NULL is set by zoom constraints

base_url

tile provider URL expert use only

verbose

report messages or suppress them

Details

get_tiles() may be run with no arguments, and will download (and report on) the default tile source at zoom 0. Arguments type, zoom (or max_tiles), format may be used without setting loc or buffer and the entire world extent will be used. Please use with caution! There is no maximum on what will be downloaded, but it can be interrupted at any time.

Use debug = TRUE to avoid download and simply report on what would be done.

cc_elevation does extra work to unpack the DEM tiles from the RGB format.

Available types are 'elevation-tiles-prod' for AWS elevation tiles, and 'mapbox.satellite', 'mapbox.outdoors', 'mapbox.terrain-rgb', 'mapbox.streets', 'mapbox.light', 'mapbox.dark' or any other string accepted by Mapbox services.

Value

A list with files downloaded in character vector, a data frame of the tile indices, the zoom level used and the extent in raster::extent form.

See Also

get_tiles_zoom get_tiles_dim get_tiles_buffer

Examples

if (!is.null(get_api_key())) {
   tile_info <- get_tiles(raster::extent(146, 147, -43, -42), type = "mapbox.outdoors", zoom = 5)
}

[Package ceramic version 0.6.0 Index]