Random GeoJSON polygon

geo_polygon(count = 1, num_vertices = 10, max_radial_length = 10,
  bbox = NULL)

Arguments

count

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

num_vertices

(integer/numeric) how many coordinates each polygon will contain. Default: 10

max_radial_length

(integer/numeric) maximum distance that a vertex can reach out of the center of the polygon. Units are in degrees latitude (Approximately 69 miles or 111 km). Default: 10

bbox

(integer/numeric) lat/long bounding box for the centers of the polygons, numeric vector of the form west (long), south (lat), east (long), north (lat). optional

Value

GeoJSON; a list with one ore more Polygons in a FeatureCollection, with class geo_list - simple unclass() to remove the class

Examples

geo_polygon()
#> $type #> [1] "FeatureCollection" #> #> $features #> $features[[1]] #> $features[[1]]$type #> [1] "Feature" #> #> $features[[1]]$geometry #> $features[[1]]$geometry$type #> [1] "Polygon" #> #> $features[[1]]$geometry$coordinates #> $features[[1]]$geometry$coordinates[[1]] #> $features[[1]]$geometry$coordinates[[1]][[1]] #> [1] 115.96093 64.21108 #> #> $features[[1]]$geometry$coordinates[[1]][[2]] #> [1] 120.75368 65.91909 #> #> $features[[1]]$geometry$coordinates[[1]][[3]] #> [1] 118.53046 62.61941 #> #> $features[[1]]$geometry$coordinates[[1]][[4]] #> [1] 121.87439 62.71219 #> #> $features[[1]]$geometry$coordinates[[1]][[5]] #> [1] 116.29626 60.44967 #> #> $features[[1]]$geometry$coordinates[[1]][[6]] #> [1] 113.58942 58.84278 #> #> $features[[1]]$geometry$coordinates[[1]][[7]] #> [1] 103.77614 51.04007 #> #> $features[[1]]$geometry$coordinates[[1]][[8]] #> [1] 110.02834 58.47168 #> #> $features[[1]]$geometry$coordinates[[1]][[9]] #> [1] 98.76928 62.38827 #> #> $features[[1]]$geometry$coordinates[[1]][[10]] #> [1] 101.17285 66.02952 #> #> $features[[1]]$geometry$coordinates[[1]][[11]] #> [1] 115.96093 64.21108 #> #> #> #> #> $features[[1]]$properties #> NULL #> #> #> #> attr(,"class") #> [1] "geo_list"
geo_polygon(10)
#> $type #> [1] "FeatureCollection" #> #> $features #> $features[[1]] #> $features[[1]]$type #> [1] "Feature" #> #> $features[[1]]$geometry #> $features[[1]]$geometry$type #> [1] "Polygon" #> #> $features[[1]]$geometry$coordinates #> $features[[1]]$geometry$coordinates[[1]] #> $features[[1]]$geometry$coordinates[[1]][[1]] #> [1] 159.1415 41.0821 #> #> $features[[1]]$geometry$coordinates[[1]][[2]] #> [1] 159.60906 35.55903 #> #> $features[[1]]$geometry$coordinates[[1]][[3]] #> [1] 163.47179 37.04195 #> #> $features[[1]]$geometry$coordinates[[1]][[4]] #> [1] 164.69595 29.03442 #> #> $features[[1]]$geometry$coordinates[[1]][[5]] #> [1] 157.29189 33.28822 #> #> $features[[1]]$geometry$coordinates[[1]][[6]] #> [1] 154.34700 34.01361 #> #> $features[[1]]$geometry$coordinates[[1]][[7]] #> [1] 153.93747 34.52634 #> #> $features[[1]]$geometry$coordinates[[1]][[8]] #> [1] 157.26336 34.58836 #> #> $features[[1]]$geometry$coordinates[[1]][[9]] #> [1] 147.16215 36.22283 #> #> $features[[1]]$geometry$coordinates[[1]][[10]] #> [1] 156.6049 38.6440 #> #> $features[[1]]$geometry$coordinates[[1]][[11]] #> [1] 159.1415 41.0821 #> #> #> #> #> $features[[1]]$properties #> NULL #> #> #> $features[[2]] #> $features[[2]]$type #> [1] "Feature" #> #> $features[[2]]$geometry #> $features[[2]]$geometry$type #> [1] "Polygon" #> #> $features[[2]]$geometry$coordinates #> $features[[2]]$geometry$coordinates[[1]] #> $features[[2]]$geometry$coordinates[[1]][[1]] #> [1] -162.85010 -28.98764 #> #> $features[[2]]$geometry$coordinates[[1]][[2]] #> [1] -158.68016 -38.90592 #> #> $features[[2]]$geometry$coordinates[[1]][[3]] #> [1] -166.55490 -37.72285 #> #> $features[[2]]$geometry$coordinates[[1]][[4]] #> [1] -169.11061 -36.56811 #> #> $features[[2]]$geometry$coordinates[[1]][[5]] #> [1] -174.11420 -39.77686 #> #> $features[[2]]$geometry$coordinates[[1]][[6]] #> [1] -177.80830 -39.67568 #> #> $features[[2]]$geometry$coordinates[[1]][[7]] #> [1] -170.07573 -35.02571 #> #> $features[[2]]$geometry$coordinates[[1]][[8]] #> [1] -178.35182 -36.94371 #> #> $features[[2]]$geometry$coordinates[[1]][[9]] #> [1] -172.2119 -35.4245 #> #> $features[[2]]$geometry$coordinates[[1]][[10]] #> [1] -169.75117 -34.74007 #> #> $features[[2]]$geometry$coordinates[[1]][[11]] #> [1] -162.85010 -28.98764 #> #> #> #> #> $features[[2]]$properties #> NULL #> #> #> $features[[3]] #> $features[[3]]$type #> [1] "Feature" #> #> $features[[3]]$geometry #> $features[[3]]$geometry$type #> [1] "Polygon" #> #> $features[[3]]$geometry$coordinates #> $features[[3]]$geometry$coordinates[[1]] #> $features[[3]]$geometry$coordinates[[1]][[1]] #> [1] -117.6866893 0.8088148 #> #> $features[[3]]$geometry$coordinates[[1]][[2]] #> [1] -117.068408 -2.893618 #> #> $features[[3]]$geometry$coordinates[[1]][[3]] #> [1] -114.693381 -1.808236 #> #> $features[[3]]$geometry$coordinates[[1]][[4]] #> [1] -115.812575 -4.143181 #> #> $features[[3]]$geometry$coordinates[[1]][[5]] #> [1] -115.12270 -13.32462 #> #> $features[[3]]$geometry$coordinates[[1]][[6]] #> [1] -121.57430 -11.54943 #> #> $features[[3]]$geometry$coordinates[[1]][[7]] #> [1] -125.92584 -14.39116 #> #> $features[[3]]$geometry$coordinates[[1]][[8]] #> [1] -127.679014 -5.341101 #> #> $features[[3]]$geometry$coordinates[[1]][[9]] #> [1] -121.326663 -4.596582 #> #> $features[[3]]$geometry$coordinates[[1]][[10]] #> [1] -120.691220 -6.577565 #> #> $features[[3]]$geometry$coordinates[[1]][[11]] #> [1] -117.6866893 0.8088148 #> #> #> #> #> $features[[3]]$properties #> NULL #> #> #> $features[[4]] #> $features[[4]]$type #> [1] "Feature" #> #> $features[[4]]$geometry #> $features[[4]]$geometry$type #> [1] "Polygon" #> #> $features[[4]]$geometry$coordinates #> $features[[4]]$geometry$coordinates[[1]] #> $features[[4]]$geometry$coordinates[[1]][[1]] #> [1] -163.09353 51.98867 #> #> $features[[4]]$geometry$coordinates[[1]][[2]] #> [1] -149.95869 44.58485 #> #> $features[[4]]$geometry$coordinates[[1]][[3]] #> [1] -155.6320 38.3543 #> #> $features[[4]]$geometry$coordinates[[1]][[4]] #> [1] -164.14081 33.81028 #> #> $features[[4]]$geometry$coordinates[[1]][[5]] #> [1] -166.0154 33.1275 #> #> $features[[4]]$geometry$coordinates[[1]][[6]] #> [1] -163.47784 42.83862 #> #> $features[[4]]$geometry$coordinates[[1]][[7]] #> [1] -167.9918 45.2449 #> #> $features[[4]]$geometry$coordinates[[1]][[8]] #> [1] -169.99309 46.82229 #> #> $features[[4]]$geometry$coordinates[[1]][[9]] #> [1] -173.9668 49.1118 #> #> $features[[4]]$geometry$coordinates[[1]][[10]] #> [1] -164.61972 45.57618 #> #> $features[[4]]$geometry$coordinates[[1]][[11]] #> [1] -163.09353 51.98867 #> #> #> #> #> $features[[4]]$properties #> NULL #> #> #> $features[[5]] #> $features[[5]]$type #> [1] "Feature" #> #> $features[[5]]$geometry #> $features[[5]]$geometry$type #> [1] "Polygon" #> #> $features[[5]]$geometry$coordinates #> $features[[5]]$geometry$coordinates[[1]] #> $features[[5]]$geometry$coordinates[[1]][[1]] #> [1] -75.72248 -40.25297 #> #> $features[[5]]$geometry$coordinates[[1]][[2]] #> [1] -78.66045 -49.61780 #> #> $features[[5]]$geometry$coordinates[[1]][[3]] #> [1] -70.56647 -48.24423 #> #> $features[[5]]$geometry$coordinates[[1]][[4]] #> [1] -75.72745 -50.69330 #> #> $features[[5]]$geometry$coordinates[[1]][[5]] #> [1] -71.40086 -54.27237 #> #> $features[[5]]$geometry$coordinates[[1]][[6]] #> [1] -70.78539 -55.06920 #> #> $features[[5]]$geometry$coordinates[[1]][[7]] #> [1] -75.80780 -58.18693 #> #> $features[[5]]$geometry$coordinates[[1]][[8]] #> [1] -84.61625 -49.96472 #> #> $features[[5]]$geometry$coordinates[[1]][[9]] #> [1] -92.36297 -48.85947 #> #> $features[[5]]$geometry$coordinates[[1]][[10]] #> [1] -84.62542 -42.25004 #> #> $features[[5]]$geometry$coordinates[[1]][[11]] #> [1] -75.72248 -40.25297 #> #> #> #> #> $features[[5]]$properties #> NULL #> #> #> $features[[6]] #> $features[[6]]$type #> [1] "Feature" #> #> $features[[6]]$geometry #> $features[[6]]$geometry$type #> [1] "Polygon" #> #> $features[[6]]$geometry$coordinates #> $features[[6]]$geometry$coordinates[[1]] #> $features[[6]]$geometry$coordinates[[1]][[1]] #> [1] -174.06129 20.00849 #> #> $features[[6]]$geometry$coordinates[[1]][[2]] #> [1] -171.38416 22.05271 #> #> $features[[6]]$geometry$coordinates[[1]][[3]] #> [1] -176.40441 16.78065 #> #> $features[[6]]$geometry$coordinates[[1]][[4]] #> [1] -174.53143 13.28003 #> #> $features[[6]]$geometry$coordinates[[1]][[5]] #> [1] -176.91548 13.22745 #> #> $features[[6]]$geometry$coordinates[[1]][[6]] #> [1] -177.09936 10.84794 #> #> $features[[6]]$geometry$coordinates[[1]][[7]] #> [1] -177.40767 15.62236 #> #> $features[[6]]$geometry$coordinates[[1]][[8]] #> [1] -178.27572 15.57863 #> #> $features[[6]]$geometry$coordinates[[1]][[9]] #> [1] 172.37843 17.69339 #> #> $features[[6]]$geometry$coordinates[[1]][[10]] #> [1] 179.00446 24.61757 #> #> $features[[6]]$geometry$coordinates[[1]][[11]] #> [1] -174.06129 20.00849 #> #> #> #> #> $features[[6]]$properties #> NULL #> #> #> $features[[7]] #> $features[[7]]$type #> [1] "Feature" #> #> $features[[7]]$geometry #> $features[[7]]$geometry$type #> [1] "Polygon" #> #> $features[[7]]$geometry$coordinates #> $features[[7]]$geometry$coordinates[[1]] #> $features[[7]]$geometry$coordinates[[1]][[1]] #> [1] 15.78893 34.59419 #> #> $features[[7]]$geometry$coordinates[[1]][[2]] #> [1] 20.57688 33.77514 #> #> $features[[7]]$geometry$coordinates[[1]][[3]] #> [1] 17.91426 26.90898 #> #> $features[[7]]$geometry$coordinates[[1]][[4]] #> [1] 13.42341 21.29710 #> #> $features[[7]]$geometry$coordinates[[1]][[5]] #> [1] 10.93275 28.17205 #> #> $features[[7]]$geometry$coordinates[[1]][[6]] #> [1] 9.832739 20.085385 #> #> $features[[7]]$geometry$coordinates[[1]][[7]] #> [1] 8.077132 20.993796 #> #> $features[[7]]$geometry$coordinates[[1]][[8]] #> [1] 6.650488 22.654813 #> #> $features[[7]]$geometry$coordinates[[1]][[9]] #> [1] 7.458519 26.682319 #> #> $features[[7]]$geometry$coordinates[[1]][[10]] #> [1] 6.844309 32.893940 #> #> $features[[7]]$geometry$coordinates[[1]][[11]] #> [1] 15.78893 34.59419 #> #> #> #> #> $features[[7]]$properties #> NULL #> #> #> $features[[8]] #> $features[[8]]$type #> [1] "Feature" #> #> $features[[8]]$geometry #> $features[[8]]$geometry$type #> [1] "Polygon" #> #> $features[[8]]$geometry$coordinates #> $features[[8]]$geometry$coordinates[[1]] #> $features[[8]]$geometry$coordinates[[1]][[1]] #> [1] 49.31968 31.70808 #> #> $features[[8]]$geometry$coordinates[[1]][[2]] #> [1] 51.67309 29.76739 #> #> $features[[8]]$geometry$coordinates[[1]][[3]] #> [1] 56.56034 27.94079 #> #> $features[[8]]$geometry$coordinates[[1]][[4]] #> [1] 48.08573 28.73189 #> #> $features[[8]]$geometry$coordinates[[1]][[5]] #> [1] 48.37730 28.23347 #> #> $features[[8]]$geometry$coordinates[[1]][[6]] #> [1] 47.44323 26.15175 #> #> $features[[8]]$geometry$coordinates[[1]][[7]] #> [1] 46.21164 23.02375 #> #> $features[[8]]$geometry$coordinates[[1]][[8]] #> [1] 45.32643 26.90101 #> #> $features[[8]]$geometry$coordinates[[1]][[9]] #> [1] 46.88411 28.74668 #> #> $features[[8]]$geometry$coordinates[[1]][[10]] #> [1] 39.29261 29.54388 #> #> $features[[8]]$geometry$coordinates[[1]][[11]] #> [1] 49.31968 31.70808 #> #> #> #> #> $features[[8]]$properties #> NULL #> #> #> $features[[9]] #> $features[[9]]$type #> [1] "Feature" #> #> $features[[9]]$geometry #> $features[[9]]$geometry$type #> [1] "Polygon" #> #> $features[[9]]$geometry$coordinates #> $features[[9]]$geometry$coordinates[[1]] #> $features[[9]]$geometry$coordinates[[1]][[1]] #> [1] 94.99317 34.94721 #> #> $features[[9]]$geometry$coordinates[[1]][[2]] #> [1] 95.80409 20.53250 #> #> $features[[9]]$geometry$coordinates[[1]][[3]] #> [1] 90.18590 26.81115 #> #> $features[[9]]$geometry$coordinates[[1]][[4]] #> [1] 90.05382 23.45053 #> #> $features[[9]]$geometry$coordinates[[1]][[5]] #> [1] 88.86772 25.78736 #> #> $features[[9]]$geometry$coordinates[[1]][[6]] #> [1] 82.20094 21.47633 #> #> $features[[9]]$geometry$coordinates[[1]][[7]] #> [1] 80.91600 31.54879 #> #> $features[[9]]$geometry$coordinates[[1]][[8]] #> [1] 88.63857 28.70608 #> #> $features[[9]]$geometry$coordinates[[1]][[9]] #> [1] 83.29856 33.62906 #> #> $features[[9]]$geometry$coordinates[[1]][[10]] #> [1] 90.0116 27.3759 #> #> $features[[9]]$geometry$coordinates[[1]][[11]] #> [1] 94.99317 34.94721 #> #> #> #> #> $features[[9]]$properties #> NULL #> #> #> $features[[10]] #> $features[[10]]$type #> [1] "Feature" #> #> $features[[10]]$geometry #> $features[[10]]$geometry$type #> [1] "Polygon" #> #> $features[[10]]$geometry$coordinates #> $features[[10]]$geometry$coordinates[[1]] #> $features[[10]]$geometry$coordinates[[1]][[1]] #> [1] 64.81519 16.67556 #> #> $features[[10]]$geometry$coordinates[[1]][[2]] #> [1] 63.78095 12.95124 #> #> $features[[10]]$geometry$coordinates[[1]][[3]] #> [1] 63.47427 12.16872 #> #> $features[[10]]$geometry$coordinates[[1]][[4]] #> [1] 62.08952 12.16787 #> #> $features[[10]]$geometry$coordinates[[1]][[5]] #> [1] 64.26561 11.02031 #> #> $features[[10]]$geometry$coordinates[[1]][[6]] #> [1] 64.955481 2.980156 #> #> $features[[10]]$geometry$coordinates[[1]][[7]] #> [1] 60.61845 11.38733 #> #> $features[[10]]$geometry$coordinates[[1]][[8]] #> [1] 55.458332 8.138475 #> #> $features[[10]]$geometry$coordinates[[1]][[9]] #> [1] 59.95903 14.04069 #> #> $features[[10]]$geometry$coordinates[[1]][[10]] #> [1] 60.79259 13.46167 #> #> $features[[10]]$geometry$coordinates[[1]][[11]] #> [1] 64.81519 16.67556 #> #> #> #> #> $features[[10]]$properties #> NULL #> #> #> #> attr(,"class") #> [1] "geo_list"
geo_polygon(bbox = c(50, 50, 60, 60))
#> $type #> [1] "FeatureCollection" #> #> $features #> $features[[1]] #> $features[[1]]$type #> [1] "Feature" #> #> $features[[1]]$geometry #> $features[[1]]$geometry$type #> [1] "Polygon" #> #> $features[[1]]$geometry$coordinates #> $features[[1]]$geometry$coordinates[[1]] #> $features[[1]]$geometry$coordinates[[1]][[1]] #> [1] 60.38588 55.79319 #> #> $features[[1]]$geometry$coordinates[[1]][[2]] #> [1] 65.04360 58.09262 #> #> $features[[1]]$geometry$coordinates[[1]][[3]] #> [1] 60.31371 50.61344 #> #> $features[[1]]$geometry$coordinates[[1]][[4]] #> [1] 60.06337 48.24432 #> #> $features[[1]]$geometry$coordinates[[1]][[5]] #> [1] 57.73071 45.38884 #> #> $features[[1]]$geometry$coordinates[[1]][[6]] #> [1] 57.08087 48.04899 #> #> $features[[1]]$geometry$coordinates[[1]][[7]] #> [1] 55.01187 47.17436 #> #> $features[[1]]$geometry$coordinates[[1]][[8]] #> [1] 52.57938 49.44271 #> #> $features[[1]]$geometry$coordinates[[1]][[9]] #> [1] 56.43616 50.12316 #> #> $features[[1]]$geometry$coordinates[[1]][[10]] #> [1] 59.05194 51.00783 #> #> $features[[1]]$geometry$coordinates[[1]][[11]] #> [1] 60.38588 55.79319 #> #> #> #> #> $features[[1]]$properties #> NULL #> #> #> #> attr(,"class") #> [1] "geo_list"