Random position

rg_position(count = 1, bbox = NULL)

Arguments

count

(integer/numeric) number of positions. Default: 1

bbox

(integer/numeric) lat/long bounding box from which to generate positions; numeric vector of the form west (long), south (lat), east (long), north (lat). optional

Value

A list, each element is a numeric vector length two of long, lat

Examples

rg_position()
#> [[1]] #> [1] 8.740848 0.363802 #>
rg_position(10)
#> [[1]] #> [1] -174.70123 -66.32505 #> #> [[2]] #> [1] -16.88788 -74.37895 #> #> [[3]] #> [1] 16.09386 16.25514 #> #> [[4]] #> [1] 1.132598 58.291455 #> #> [[5]] #> [1] 169.12508 -17.27766 #> #> [[6]] #> [1] 174.443568 -4.144179 #> #> [[7]] #> [1] 93.981386 -7.398605 #> #> [[8]] #> [1] 100.24355 -16.14815 #> #> [[9]] #> [1] -43.57414 16.31623 #> #> [[10]] #> [1] 123.923310 4.962381 #>
rg_position(100)
#> [[1]] #> [1] -115.54766 -68.81499 #> #> [[2]] #> [1] 76.8283 71.8470 #> #> [[3]] #> [1] 45.52434 -40.98357 #> #> [[4]] #> [1] 51.50485 -24.64335 #> #> [[5]] #> [1] 133.46178 25.87281 #> #> [[6]] #> [1] -117.63906 51.32104 #> #> [[7]] #> [1] 31.03999 -44.54286 #> #> [[8]] #> [1] 151.74942 -20.56831 #> #> [[9]] #> [1] -53.78826 79.32195 #> #> [[10]] #> [1] -24.87643 -26.73536 #> #> [[11]] #> [1] -31.5877 -5.8385 #> #> [[12]] #> [1] -123.71019 66.06375 #> #> [[13]] #> [1] 66.471881 -1.650633 #> #> [[14]] #> [1] 160.44763 -43.32957 #> #> [[15]] #> [1] -156.64209 -31.61587 #> #> [[16]] #> [1] -151.7817 47.1372 #> #> [[17]] #> [1] 111.490632 -6.820918 #> #> [[18]] #> [1] 84.14269 17.49419 #> #> [[19]] #> [1] 173.7607 10.5033 #> #> [[20]] #> [1] -50.08547 -17.75937 #> #> [[21]] #> [1] -128.31868 -21.19832 #> #> [[22]] #> [1] 129.3429 -42.6299 #> #> [[23]] #> [1] 137.27265 31.64162 #> #> [[24]] #> [1] 28.30710 -52.73136 #> #> [[25]] #> [1] -56.00555 -31.44746 #> #> [[26]] #> [1] 83.19731 -44.81862 #> #> [[27]] #> [1] 171.29449 50.70586 #> #> [[28]] #> [1] 169.29442 -17.22744 #> #> [[29]] #> [1] -159.813704 3.079745 #> #> [[30]] #> [1] -73.93500 -12.74423 #> #> [[31]] #> [1] -136.40080 -15.00083 #> #> [[32]] #> [1] 76.30391 -12.95382 #> #> [[33]] #> [1] -167.60548 -19.37695 #> #> [[34]] #> [1] 55.068220 5.525176 #> #> [[35]] #> [1] 6.049477 -20.684489 #> #> [[36]] #> [1] 137.13591 -27.54585 #> #> [[37]] #> [1] -36.496867 7.987595 #> #> [[38]] #> [1] -127.653355 5.610158 #> #> [[39]] #> [1] 28.36134 59.22304 #> #> [[40]] #> [1] 87.237425 -5.649427 #> #> [[41]] #> [1] 48.43594 46.61402 #> #> [[42]] #> [1] 154.88406 -17.59203 #> #> [[43]] #> [1] 10.33534 33.35118 #> #> [[44]] #> [1] 173.97607 51.43509 #> #> [[45]] #> [1] -154.81961 -33.73076 #> #> [[46]] #> [1] 56.99600 28.78959 #> #> [[47]] #> [1] 150.60162 44.63431 #> #> [[48]] #> [1] 50.64497 36.69271 #> #> [[49]] #> [1] 87.70367 -44.04912 #> #> [[50]] #> [1] 127.30891 -37.36029 #> #> [[51]] #> [1] -171.40436 -36.21063 #> #> [[52]] #> [1] 139.15818 -11.54133 #> #> [[53]] #> [1] -24.19626 -57.19841 #> #> [[54]] #> [1] 41.765194 7.386601 #> #> [[55]] #> [1] 143.02959 -32.54943 #> #> [[56]] #> [1] -133.878327 -4.431446 #> #> [[57]] #> [1] -133.554159 -1.256584 #> #> [[58]] #> [1] 15.76537 31.09428 #> #> [[59]] #> [1] 109.13188 -63.61491 #> #> [[60]] #> [1] -33.349916 -1.689847 #> #> [[61]] #> [1] 173.35507 16.95536 #> #> [[62]] #> [1] -15.89755 34.05238 #> #> [[63]] #> [1] -150.54011 15.16074 #> #> [[64]] #> [1] -134.40003 -28.66875 #> #> [[65]] #> [1] 164.11186 -19.71544 #> #> [[66]] #> [1] -11.487834 -4.380799 #> #> [[67]] #> [1] -60.85667 -14.91372 #> #> [[68]] #> [1] -17.08111 -50.89854 #> #> [[69]] #> [1] 102.31266 46.37583 #> #> [[70]] #> [1] -78.72730 -24.44962 #> #> [[71]] #> [1] -20.81271 -20.81778 #> #> [[72]] #> [1] 72.25739 59.67634 #> #> [[73]] #> [1] 165.06127 30.73266 #> #> [[74]] #> [1] 153.4620005 -0.3147934 #> #> [[75]] #> [1] 156.786171 7.030676 #> #> [[76]] #> [1] -53.824847 2.693425 #> #> [[77]] #> [1] 167.8174 23.9335 #> #> [[78]] #> [1] -75.36661 -46.00864 #> #> [[79]] #> [1] -110.40744 -38.18603 #> #> [[80]] #> [1] -48.42486 29.64342 #> #> [[81]] #> [1] 128.18916 47.72726 #> #> [[82]] #> [1] 105.08676 16.75004 #> #> [[83]] #> [1] 167.16378 49.69692 #> #> [[84]] #> [1] -15.062166 -2.711152 #> #> [[85]] #> [1] 121.34222 68.90611 #> #> [[86]] #> [1] -164.40176 -35.74691 #> #> [[87]] #> [1] -107.02837 59.58816 #> #> [[88]] #> [1] 131.19879 57.75993 #> #> [[89]] #> [1] -24.83877 -71.30623 #> #> [[90]] #> [1] 25.54464 -30.58482 #> #> [[91]] #> [1] -92.71644 -14.73304 #> #> [[92]] #> [1] -119.37074 6.33957 #> #> [[93]] #> [1] -120.71692 49.76898 #> #> [[94]] #> [1] -47.71282 -63.26768 #> #> [[95]] #> [1] 135.14787 28.67771 #> #> [[96]] #> [1] 56.62744 49.13653 #> #> [[97]] #> [1] -65.21471 -14.24815 #> #> [[98]] #> [1] -19.08093 -24.61929 #> #> [[99]] #> [1] 140.41044 52.31532 #> #> [[100]] #> [1] 46.94822 -43.08776 #>
rg_position(bbox = c(50, 50, 60, 60))
#> [[1]] #> [1] 53.64262 55.92704 #>
# coerce to data.frame stats::setNames( do.call("rbind.data.frame", rg_position(10)), c('lng', 'lat') )
#> lng lat #> 1 -14.130895 42.31262 #> 2 4.992070 45.51771 #> 3 54.107532 43.58350 #> 4 2.991550 55.92032 #> 5 1.089599 67.34728 #> 6 116.651836 25.34253 #> 7 -91.169688 11.77172 #> 8 47.553435 -63.78694 #> 9 -57.557072 -14.75770 #> 10 116.969542 45.21614