Skip to contents

Change CRS of coordinates

Usage

convert_crs(x, y, crs_in = "+proj=longlat +datum=WGS84", crs_out = "EPSG:3338")

Arguments

x

Decimal degrees longititude.

y

Decimal degrees latitude.

crs_in

Default = "+proj=longlat +datum=WGS84".

crs_out

Default = "EPSG:3338".

Value

data.frame with 3 columns: ID, Longitude, and Latitude

Examples

convert_crs(x = 170, y = 62)
#>   ID        X       Y
#> 1  1 -1789232 1833161
dat <- sdmgamindex::noaa_afsc_public_foss[,c("longitude_dd_start", "latitude_dd_start")]
head(dat)
#>   longitude_dd_start latitude_dd_start
#> 1          -171.3599          56.65940
#> 2          -173.2508          56.99770
#> 3          -170.2871          57.67576
#> 4          -166.5287          58.00859
#> 5          -176.7193          60.02075
#> 6          -177.0694          59.32891
ll <- sdmgamindex::convert_crs( # project data
   x = dat$longitude_dd_start,
   y = dat$latitude_dd_start,
   crs_in = "+proj=longlat +datum=WGS84",
   crs_out = "EPSG:3338")
head(ll)
#>   ID          X         Y
#> 1  1 -1050529.3  877146.6
#> 2  2 -1151106.0  944820.3
#> 3  3  -959416.2  970747.6
#> 4  4  -734085.4  959133.7
#> 5  5 -1237677.9 1328406.2
#> 6  6 -1282319.2 1262236.5