st_transform_DT: Change the projection within a data table

View source: R/st_transform_DT.R

st_transform_DTR Documentation

Change the projection within a data table

Description

Change the projection within a data table

Usage

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 ")
)

Arguments

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)

Value

Data.table as it was with changed projection

Examples

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)

krietsch/auksRuak documentation built on Feb. 15, 2023, 2:44 p.m.