Attention: Please use this function for CRS transformations, since it is based on the st_transform from the sf package and therefore supports CRS transformations in 3-D. Note: spTransform from the sp package only supports transformations in the 2D plane, which will cause distortions in the third dimension.

transformCRS.3d(track, fromCRS, toCRS)

Arguments

track

data.frame with x,y,z coordinates

fromCRS

numeric, EPSG code of the current CRS

toCRS

numeric, EPSG code of the CRS to be converted in

Value

A data.frame containing x,y,z and variables.

Examples

transformCRS.3d(niclas, fromCRS = 2056, toCRS = 4326)
#>           x        y        z           a            g           t
#> 1  6.868026 46.84473 1283.736  0.29022670 1.570781e+00          NA
#> 2  6.895325 46.85352 1359.580  0.31124324 3.780922e-04  0.02101655
#> 3  6.920342 46.85870 1369.713  0.20435409 2.521324e-03 -0.10688916
#> 4  6.945902 46.86607 1391.752  0.28087933 1.207054e-03  0.07652524
#> 5  6.963975 46.86605 1806.566 -0.00148285 4.356966e-05 -0.28236218
#> 6  7.017997 46.88671 1764.062  0.36526329 3.140232e+00  0.36674614
#> 7  7.082597 46.91257 1532.481  0.38074869 3.141292e+00  0.01548540
#> 8  7.137261 46.93549 1407.334  0.39705801 3.141119e+00  0.01630932
#> 9  7.180323 46.95527 1282.171  0.43072179 3.141214e+00  0.03366378
#> 10 7.198807 46.96761 1513.318  0.58839577 9.613236e-05  0.15767398
#> 11 7.230685 46.99044 1553.903  0.62150743 9.661100e-04  0.03311166
#> 12 7.268758 47.02529 1355.825  0.74131273 3.141332e+00  0.11980530
#> 13 7.306239 47.05830 1180.242  0.72196445 3.141308e+00 -0.01934828
#> 14 7.324075 47.06770 1249.781  0.48533251 2.899786e-04 -0.23663194
#> 15 7.337493 47.08205 1427.830  0.81887038 1.103280e-04  0.33353787
#> 16 7.349967 47.08237 1448.141  0.02549749 6.143516e-04 -0.79337289
#> 17 7.401676 47.10885 1565.054  0.47335616 4.969230e-04  0.44785866
#> 18 7.464232 47.12686 1486.655  0.28026606 3.140762e+00 -0.19309009
#> 19 7.525779 47.13273 1428.523  0.09502670 3.140529e+00 -0.18523937
#> 20 7.596006 47.14952 1245.329  0.23476598 3.141198e+00  0.13973928
#> 21 7.629472 47.15956 1374.984  0.29125803 2.694591e-04  0.05649205
#> 22 7.698594 47.17736 1299.593  0.25210505 3.140646e+00 -0.03915298
#> 23 7.742600 47.18721 1637.258  0.22007079 1.335443e-04 -0.03203426
#> 24 7.817804 47.21143 1449.789  0.31162099 3.141171e+00  0.09155020
#> 25 7.889830 47.22471 1380.690  0.18231683 3.140533e+00 -0.12930416
#> 26 7.971334 47.23750 1180.499  0.15567910 3.141181e+00 -0.02663773
#> 27 8.055092 47.22623 1280.248 -0.13377353 8.472659e-04 -0.28945263
#> 28 8.131064 47.20756 1369.771 -0.24090985 8.738572e-04 -0.10713632
#> 29 8.188827 47.21677 1330.951  0.15812836 3.140086e+00  0.39903821
#> 30 8.218898 47.21298 1388.270 -0.12565518 5.287908e-04 -0.28378354
#> 31 8.260129 47.22052 1088.630  0.18087906 3.141453e+00  0.30653424
#>                l         d
#> 1             NA        NA
#> 2  -1.570403e+00  75.84387
#> 3   2.143232e-03  10.13302
#> 4  -1.314270e-03  22.03912
#> 5  -1.163484e-03 414.81432
#> 6   3.140188e+00  42.50395
#> 7   1.060286e-03 231.58153
#> 8  -1.731698e-04 125.14655
#> 9   9.500965e-05 125.16370
#> 10 -3.141118e+00 231.14703
#> 11  8.699776e-04  40.58533
#> 12  3.140366e+00 198.07818
#> 13 -2.382819e-05 175.58304
#> 14 -3.141018e+00  69.53945
#> 15 -1.796505e-04 178.04861
#> 16  5.040236e-04  20.31140
#> 17 -1.174286e-04 116.91293
#> 18  3.140265e+00  78.39938
#> 19 -2.332197e-04  58.13135
#> 20  6.693796e-04 183.19465
#> 21 -3.140929e+00 129.65576
#> 22  3.140376e+00  75.39197
#> 23 -3.140512e+00 337.66526
#> 24  3.141038e+00 187.46846
#> 25 -6.384796e-04  69.09927
#> 26  6.478172e-04 200.19098
#> 27 -3.140333e+00  99.74901
#> 28  2.659127e-05  89.52327
#> 29  3.139212e+00  38.82061
#> 30 -3.139557e+00  57.31907
#> 31  3.140924e+00 299.64033