Skip to contents

Attribute trees to GPS coordinates

Usage

attributeTreeCoord(xy, plot, dim, coordAbs)

Arguments

xy

The relative coordinates of the trees within each plot

plot

The label of the plot (same length as the number of rows of xy or length of 1)

dim

The dimension of the plot (either one value if the plot is a square or a vector if a rectangle)

coordAbs

The result of the function cutPlot() or numberCorner()

Value

A data frame with two columns: - Xproj: The X coordinates in the absolute coordinate system - Yproj: The Y coordinates in the absolute coordinate system

Examples


# Trees relative coordinates
xy <- data.frame(x = runif(200, min = 0, max = 200), y = runif(200, min = 0, max = 200))


# cut the plot in multiple part
coord <- data.frame(X = rep(c(0, 200, 0, 200), 2), Y = rep(c(0, 0, 200, 200), 2))
coord[1:4, ] <- coord[1:4, ] + 5000
coord[5:8, ] <- coord[5:8, ] + 6000
corner <- rep(c(1, 2, 4, 3), 2)
Forestplot <- rep(c("plot1", "plot2"), each = 4)

Outcut <- cutPlot(coord, Forestplot, corner, gridsize = 100, dimX = 200, dimY = 200)


# Assign a plot to 200 trees
Forestplot <- rep(c("plot1", "plot2"), 100)

# attribute trees to subplots
attributeTreeCoord(xy, Forestplot, dim =100,coordAbs = Outcut)
#>        Xproj    Yproj
#> 1   5167.268 5069.518
#> 2   6158.845 6124.289
#> 3   5175.648 5059.177
#> 4   6181.106 6058.182
#> 5   5154.944 5123.784
#> 6   6033.687 6171.179
#> 7   5177.027 5184.044
#> 8   6096.935 6002.586
#> 9   5062.007 5131.305
#> 10  6054.524 6081.247
#> 11  5110.699 5104.871
#> 12  6155.996 6071.291
#> 13  5135.891 5032.619
#> 14  6079.686 6102.037
#> 15  5182.327 5192.752
#> 16  6123.382 6168.173
#> 17  5133.033 5181.256
#> 18  6111.329 6081.395
#> 19  5083.150 5074.307
#> 20  6123.153 6118.298
#> 21  5148.036 5150.199
#> 22  6113.146 6062.617
#> 23  5151.689 5000.413
#> 24  6023.774 6075.882
#> 25  5197.300 5111.587
#> 26  6066.999 6142.506
#> 27  5061.843 5185.416
#> 28  6155.719 6156.189
#> 29  5035.836 5048.574
#> 30  6192.861 6037.497
#> 31  5075.174 5121.651
#> 32  6011.643 6183.472
#> 33  5099.658 5022.945
#> 34  6152.760 6078.103
#> 35  5001.668 5142.283
#> 36  6195.966 6194.406
#> 37  5131.213 5025.885
#> 38  6095.547 6187.751
#> 39  5164.039 5052.832
#> 40  6162.330 6104.734
#> 41  5065.353 5032.577
#> 42  6056.614 6180.631
#> 43  5184.961 5174.077
#> 44  6151.677 6131.468
#> 45  5018.731 5153.761
#> 46  6039.783 6049.047
#> 47  5031.452 5065.649
#> 48  6037.970 6008.995
#> 49  5179.759 5155.635
#> 50  6094.585 6096.610
#> 51  5060.144 5016.769
#> 52  6141.483 6103.360
#> 53  5068.067 5028.458
#> 54  6134.402 6136.729
#> 55  5171.587 5070.391
#> 56  6138.778 6196.790
#> 57  5173.279 5173.414
#> 58  6157.953 6199.008
#> 59  5030.182 5057.909
#> 60  6086.038 6136.685
#> 61  5087.469 5130.715
#> 62  6190.966 6009.425
#> 63  5158.078 5112.817
#> 64  6195.390 6076.210
#> 65  5094.354 5026.483
#> 66  6052.028 6029.137
#> 67  5193.367 5073.231
#> 68  6062.103 6106.111
#> 69  5179.576 5007.869
#> 70  6134.149 6174.910
#> 71  5111.937 5173.837
#> 72  6133.942 6197.701
#> 73  5180.300 5113.530
#> 74  6074.983 6189.310
#> 75  5088.165 5025.414
#> 76  6074.222 6080.064
#> 77  5010.837 5078.242
#> 78  6064.627 6034.688
#> 79  5089.262 5104.899
#> 80  6117.583 6049.920
#> 81  5146.236 5101.193
#> 82  6060.278 6072.561
#> 83  5123.941 5186.146
#> 84  6086.418 6149.943
#> 85  5059.174 5145.980
#> 86  6043.140 6109.322
#> 87  5099.323 5090.499
#> 88  6125.350 6064.339
#> 89  5198.230 5032.067
#> 90  6092.598 6019.953
#> 91  5182.912 5131.153
#> 92  6168.410 6056.215
#> 93  5032.972 5111.227
#> 94  6040.833 6170.655
#> 95  5180.542 5156.925
#> 96  6054.338 6159.733
#> 97  5053.875 5038.551
#> 98  6073.258 6095.339
#> 99  5092.810 5029.245
#> 100 6072.404 6027.443
#> 101 5062.551 5153.637
#> 102 6148.832 6160.829
#> 103 5161.034 5006.691
#> 104 6154.557 6196.392
#> 105 5147.594 5013.885
#> 106 6132.228 6144.018
#> 107 5194.213 5165.819
#> 108 6190.735 6055.125
#> 109 5177.936 5114.515
#> 110 6091.905 6125.116
#> 111 5106.620 5033.761
#> 112 6117.915 6022.053
#> 113 5089.821 5099.659
#> 114 6122.002 6070.725
#> 115 5047.033 5065.467
#> 116 6185.984 6141.946
#> 117 5095.069 5198.475
#> 118 6149.142 6135.829
#> 119 5047.590 5058.507
#> 120 6183.871 6120.372
#> 121 5074.726 5158.312
#> 122 6011.537 6167.397
#> 123 5056.899 5080.470
#> 124 6076.077 6156.301
#> 125 5117.712 5078.514
#> 126 6083.097 6020.142
#> 127 5117.735 5146.313
#> 128 6073.308 6190.575
#> 129 5164.281 5152.603
#> 130 6067.757 6048.159
#> 131 5146.479 5167.195
#> 132 6058.883 6135.084
#> 133 5034.489 5181.537
#> 134 6048.612 6098.370
#> 135 5035.621 5047.504
#> 136 6053.448 6118.701
#> 137 5099.366 5038.825
#> 138 6135.320 6191.589
#> 139 5034.362 5158.683
#> 140 6188.329 6043.251
#> 141 5113.572 5013.100
#> 142 6182.598 6163.634
#> 143 5119.944 5095.919
#> 144 6076.985 6108.000
#> 145 5014.102 5155.917
#> 146 6000.097 6050.101
#> 147 5133.903 5097.416
#> 148 6069.792 6142.650
#> 149 5060.139 5121.524
#> 150 6101.568 6081.173
#> 151 5010.956 5131.192
#> 152 6182.044 6175.470
#> 153 5174.154 5104.802
#> 154 6045.253 6176.728
#> 155 5142.011 5160.524
#> 156 6089.912 6056.381
#> 157 5067.520 5129.994
#> 158 6078.246 6140.107
#> 159 5189.994 5179.098
#> 160 6076.729 6192.961
#> 161 5183.987 5018.541
#> 162 6076.781 6096.769
#> 163 5064.834 5188.574
#> 164 6062.354 6162.867
#> 165 5088.275 5042.358
#> 166 6143.522 6122.043
#> 167 5176.937 5131.981
#> 168 6130.007 6019.475
#> 169 5162.718 5161.644
#> 170 6180.305 6042.420
#> 171 5075.157 5148.633
#> 172 6075.629 6017.599
#> 173 5148.510 5146.307
#> 174 6024.606 6062.391
#> 175 5177.744 5091.146
#> 176 6116.055 6103.594
#> 177 5085.479 5098.475
#> 178 6154.901 6096.216
#> 179 5186.373 5058.351
#> 180 6023.985 6132.609
#> 181 5044.221 5078.592
#> 182 6104.618 6011.699
#> 183 5163.353 5115.277
#> 184 6050.674 6009.002
#> 185 5030.319 5088.270
#> 186 6154.463 6077.419
#> 187 5114.642 5063.268
#> 188 6007.379 6006.019
#> 189 5130.773 5060.885
#> 190 6199.151 6070.265
#> 191 5064.476 5195.775
#> 192 6071.327 6081.992
#> 193 5166.075 5197.893
#> 194 6017.252 6014.859
#> 195 5015.587 5156.709
#> 196 6193.260 6054.323
#> 197 5052.713 5051.486
#> 198 6106.997 6183.150
#> 199 5103.624 5021.939
#> 200 6174.549 6036.756