Learn R Programming

rmapzen (version 0.5.1)

mz_tile_coordinates: Specify tile coordinates

Description

mz_vector_tiles requires tile coordinates or some other specification of the region that is to be drawn. mz_vector_tiles will automatically convert its inputs to vector tiles, so you generally won't need to use this function directly.

Usage

mz_tile_coordinates(x, y, z)

as.mz_tile_coordinates(obj, ...)

# S3 method for mz_tile_coordinates as.mz_tile_coordinates(obj, ...)

# S3 method for mz_bbox as.mz_tile_coordinates(obj, ..., z = NULL, height = NULL, width = NULL)

# S3 method for mz_location as.mz_tile_coordinates(obj, ..., z = 15L)

# S3 method for mz_geocode_result as.mz_tile_coordinates(obj, ..., z = 15L)

Arguments

x

integer vector of x-coordinates

y

integer vector of y-coordinates

z

integer between 0 and 19 specifying the zoom level

obj

An object that can be converted to tile coordinates

...

Other arguments passed on to methods

height

Height in pixels

width

Width in pixels

See Also

mz_vector_tiles, mz_bbox

Examples

Run this code
mz_tile_coordinates(19293, 24641, 16)

## can specify multiple contiguous tiles:
mz_tile_coordinates(19293:19294, 24641:24642, 16)

## a rectangular bounding box can be converted to tile coordinates:
as.mz_tile_coordinates(mz_rect(min_lon = -122.2856,
                               min_lat = 37.73742,
                               max_lon = -122.1749,
                               max_lat = 37.84632))

## zoom level is calculated based on desired pixel dimensions of the map:
as.mz_tile_coordinates(mz_rect(min_lon = -122.2856,
                               min_lat = 37.73742,
                               max_lon = -122.1749,
                               max_lat = 37.84632), height = 750, width = 1000)

## a bounding box can also be calculated:
as.mz_tile_coordinates(mz_bbox(oakland_public))

Run the code above in your browser using DataLab