View source: R/st_transform_DT.R
st_transform_DT | R Documentation |
Change the projection within a data table
st_transform_DT(
DT,
lat = "lat",
lon = "lon",
from = "+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs",
to = paste0("+proj=laea +lat_0=90 +lon_0=-156.653428 +x_0=0 +y_0=0",
" +datum=WGS84 +units=m +no_defs +ellps=WGS84 +towgs84=0,0,0 ")
)
DT |
Name of the data.table |
lat |
Name of the column with latitude (as.character) |
lon |
Name of the column with longitude (as.character) |
from |
Projection of the data (default is longlat) |
to |
Projection that the data should get (default is equal area with centre Barrow) |
Data.table as it was with changed projection
require(data.table)
DT = data.table(name = c('NARL', 'Utqiagvik'),
lat = c(71.320854, 71.290246),
lon = c(-156.648210, -156.788622))
st_transform_DT(DT)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.