Skip to contents

Functions to access or modify the projection of a data table. Changing the projection will trigger automatically the conversion of the locations in the new coordinate system.

Usage

projection(x)

projection(x) <- value

project(x, value)

Arguments

x

A track table.

value

A character string or a terra::crs object representing the projection of the coordinates. "+proj=longlat" is suitable for the outputs of most GPS trackers.

Value

A track table.

Note

It is not possible to modify the projection if missing coordinates are present.

See also

Author

Simon Garnier, garnier@njit.edu

Examples

data(short_tracks)

projection(short_tracks)
#> Coordinate Reference System:
#>   User input: +proj=longlat 
#>   wkt:
#> GEOGCRS["unknown",
#>     DATUM["World Geodetic System 1984",
#>         ELLIPSOID["WGS 84",6378137,298.257223563,
#>             LENGTHUNIT["metre",1]],
#>         ID["EPSG",6326]],
#>     PRIMEM["Greenwich",0,
#>         ANGLEUNIT["degree",0.0174532925199433],
#>         ID["EPSG",8901]],
#>     CS[ellipsoidal,2],
#>         AXIS["longitude",east,
#>             ORDER[1],
#>             ANGLEUNIT["degree",0.0174532925199433,
#>                 ID["EPSG",9122]]],
#>         AXIS["latitude",north,
#>             ORDER[2],
#>             ANGLEUNIT["degree",0.0174532925199433,
#>                 ID["EPSG",9122]]]]
tracks_projected <- project(short_tracks, "+proj=somerc")
projection(tracks_projected)
#> Coordinate Reference System:
#>   User input: +proj=somerc 
#>   wkt:
#> PROJCRS["unknown",
#>     BASEGEOGCRS["unknown",
#>         DATUM["World Geodetic System 1984",
#>             ELLIPSOID["WGS 84",6378137,298.257223563,
#>                 LENGTHUNIT["metre",1]],
#>             ID["EPSG",6326]],
#>         PRIMEM["Greenwich",0,
#>             ANGLEUNIT["degree",0.0174532925199433],
#>             ID["EPSG",8901]]],
#>     CONVERSION["unknown",
#>         METHOD["Hotine Oblique Mercator (variant B)",
#>             ID["EPSG",9815]],
#>         PARAMETER["Latitude of projection centre",0,
#>             ANGLEUNIT["degree",0.0174532925199433],
#>             ID["EPSG",8811]],
#>         PARAMETER["Longitude of projection centre",0,
#>             ANGLEUNIT["degree",0.0174532925199433],
#>             ID["EPSG",8812]],
#>         PARAMETER["Azimuth of initial line",90,
#>             ANGLEUNIT["degree",0.0174532925199433],
#>             ID["EPSG",8813]],
#>         PARAMETER["Angle from Rectified to Skew Grid",90,
#>             ANGLEUNIT["degree",0.0174532925199433],
#>             ID["EPSG",8814]],
#>         PARAMETER["Scale factor on initial line",1,
#>             SCALEUNIT["unity",1],
#>             ID["EPSG",8815]],
#>         PARAMETER["Easting at projection centre",0,
#>             LENGTHUNIT["metre",1],
#>             ID["EPSG",8816]],
#>         PARAMETER["Northing at projection centre",0,
#>             LENGTHUNIT["metre",1],
#>             ID["EPSG",8817]]],
#>     CS[Cartesian,2],
#>         AXIS["(E)",east,
#>             ORDER[1],
#>             LENGTHUNIT["metre",1,
#>                 ID["EPSG",9001]]],
#>         AXIS["(N)",north,
#>             ORDER[2],
#>             LENGTHUNIT["metre",1,
#>                 ID["EPSG",9001]]]]
projection(tracks_projected) <- "+proj=longlat"
projection(tracks_projected)
#> Coordinate Reference System:
#>   User input: +proj=longlat 
#>   wkt:
#> GEOGCRS["unknown",
#>     DATUM["World Geodetic System 1984",
#>         ELLIPSOID["WGS 84",6378137,298.257223563,
#>             LENGTHUNIT["metre",1]],
#>         ID["EPSG",6326]],
#>     PRIMEM["Greenwich",0,
#>         ANGLEUNIT["degree",0.0174532925199433],
#>         ID["EPSG",8901]],
#>     CS[ellipsoidal,2],
#>         AXIS["longitude",east,
#>             ORDER[1],
#>             ANGLEUNIT["degree",0.0174532925199433,
#>                 ID["EPSG",9122]]],
#>         AXIS["latitude",north,
#>             ORDER[2],
#>             ANGLEUNIT["degree",0.0174532925199433,
#>                 ID["EPSG",9122]]]]