mz_vector_tiles: Request vector tile data

View source: R/vector-tiles.R

mz_vector_tilesR Documentation

Request vector tile data

Description

From https://tilezen.readthedocs.io/en/latest/: "Vector tiles are square-shaped collections of geographic data that contain the map feature geometry, such as lines and points."

Usage

mz_vector_tiles(tile_coordinates, ..., Origin = NULL)

Arguments

tile_coordinates

an mz_tile_coordinates object, or something that can be coerced to one (including the output of mz_bbox)

...

Arguments passed on to as.mz_tile_coordinates.

Origin

optional, specify Origin URL in request header

Details

Multiple tiles are stitched together and returned as one object. Individual layers can be converted to sf or sp, making it possible to draw each layer with custom styles.

Value

A list of tile layers (such as "water", "buildings", "roads", etc.). Each layer is an object of class mapzen_vector_layer, which can be converted to sf using as_sf

See Also

mz_tile_coordinates

Examples

## Not run: 
# vector tile at x = 19293, y = 24641, and zoom level 16
mz_vector_tiles(mz_tile_coordinates(19293, 24641, 16))

# multiple contiguous tiles will be stitched together
# this returns the result of stitching together 4 tiles
mz_vector_tiles(mz_tile_coordinates(19293:19294, 24641:24642, 16))

# can also use a bounding box:
mz_vector_tiles(mz_rect(min_lon = -122.2856,
                        min_lat = 37.73742,
                        max_lon = -122.1749,
                        max_lat = 37.84632))

# mz_bbox returns a bounding box for any Mapzen object
mz_vector_tiles(mz_bbox(oakland_public))

# bounding boxes are automatically converted to tile coordinates,
# with the zoom level based on the desired size in pixels of the final map
mz_vector_tiles(mz_bbox(oakland_public), height = 750, width = 1000)

## End(Not run)


tarakc02/rmapzen documentation built on Oct. 19, 2023, 7:32 p.m.