Learn R Programming

rosm (version 0.3.0)

osm_tile: Low-level tile math

Description

Open Street Map operates using a system of tiles whose value and bounds are easily calculated from WGS84 longitude/latitude. These functions convert between tile system coordinates and longitude/latitude.

Usage

osm_tile(pt, zoom)

osm_tile_quadkey(tile)

osm_tile_top_left(tile, crs = osm_crs_native())

osm_tile_envelope(tile, crs = osm_crs_native())

Value

- `osm_tile()`: A `data.frame()` with columns `x`, `y`, and `zoom`. - `osm_tile_top_left()`: A [wk::xy()] of the top-left (northwest) corner of the tile. - `osm_tile_envelope()`: A [wk::rct()] of the tile bounds.

Arguments

pt

A vector of points as coerced by [wk::as_xy()]. The CRS for these points is considered.

zoom

A zoom level, generally between 0 and 21, with higher values representing a smaller (i.e., more detailed) tile.

tile

A `data.frame()` with columns `x`, `y`, and `zoom`.

crs

A target CRS. Either [wk::wk_crs_longlat()] or [osm_crs_native()].

Examples

Run this code
(tiles <- osm_tile(osm_lnglat(-64, 45), zoom = 0:5))
osm_tile_envelope(tiles)

Run the code above in your browser using DataLab