tile_coords {rtrek} | R Documentation |
Simple CRS coordinates
Description
Convert (column, row)
numbers to (x, y)
coordinates for a given tile set.
Usage
tile_coords(data, id)
Arguments
data |
a data frame containing columns named |
id |
character, name of map tile set ID. See stTiles. |
Details
This function converts column and row indices for an available map tile set matrix to coordinates that can be used in a Leaflet map. See stTiles for available tile sets.
data
cannot contain columns named x
or y
, which are reserved for the
column-appended output data frame.
Each tile set has a simple/non-geographical coordinate reference system
(CRS). Respective coordinates are based on the dimensions of the source image
used to generate each tile set. The same column and row pair will yield
different map coordinates for different tile sets. Typical for matrices,
columns are numbered increasing from left to right and rows increasing from
top to bottom. The output of tile_coords()
is a typical Cartesian coordinate
system, increasing from left to right and bottom to top.
Value
a data frame.
Examples
d <- data.frame(row = c(0, 3222, 6445), col = c(0, 4000, 8000))
tile_coords(d, "galaxy1")