The sf
package delivers a standardized way to encode
spatial vector data, the so called Simple Features (SF). It binds to
GDAL for reading and writing data, to GEOS for geometrical operations,
and to Proj.4 for projection conversions and datum transformations.
Therefore the eRTG3D
package comes with some wrapper
functions to convert the generated tracks to simple features. The
resulting sf, data.frame
objects enable access to the
functionality of the sf package, which also includes an easy way to
access spatial databases (PostGIS).
To convert tracks to a an object of type sf, data.frame
use the track2sf.3d()
function, which can take data.frames,
matrices and move objects (containing one track!) as input. In case of
data.frames and matrices, it is important that the coordinates are
stored in the first three rows.
niclas <- track2sf.3d(niclas, CRS = 2056)
is.sf.3d(niclas)
#> [1] TRUE
head(niclas, 3)
#> Simple feature collection with 3 features and 5 fields
#> Geometry type: POINT
#> Dimension: XYZ
#> Bounding box: xmin: 2556476 ymin: 1188336 xmax: 2560477 ymax: 1189861
#> z_range: zmin: 1283.736 zmax: 1369.713
#> Projected CRS: CH1903+ / LV95
#> a g t l d
#> 1 0.3914766 1.557032 NA NA NA
#> 2 0.4313395 1.537826 0.03986289 -0.01920514 2300.818
#> 3 0.2866134 1.565712 -0.14472610 0.02788554 1993.003
#> geometry
#> 1 POINT Z (2556476 1188336 12...
#> 2 POINT Z (2558565 1189297 13...
#> 3 POINT Z (2560477 1189861 13...