Description Usage Arguments Value Examples
Add point clusters at the points of the Global Sampling Grid
1 |
gsg |
A matrix with longitudes (first column) and latitudes (second column). |
layout |
A matrix specifiying the layout of the point cluster. See Details and Examples. |
ref |
Where is the reference of the point cluster. With default settings it is centered on the grid coordinates. Defaults can be overwritten by providing row and column indexes. See examples. |
dist |
Distance in m between points in the cluster. |
rot |
Should the clusters be rotated? Default is 0 for no rotation. If 'random', each point cluster is rotated in a random direction. If a single value is provided, all clusters are rotated in the same direction. |
SpatialPointsDataFrame. The data slot contains point and sub-point IDs.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | library(gsg);
# Generate a global sampling grid with 500km distance
gsg <- gen_gsg(500);
# Define the layout of the point cluster
# 25 points arranged in a square
layout <- matrix(rep(1, 25), nrow = 1);
# 500m between points
dist = 500;
# Centered on the grid points
ref <- c(3, 3);
# New grid with clusters
gsg_clus <- plot_design(gsg = gsg@coords,
layout = layout,
ref = ref,
dist = dist,
rot = 0);
plot(gsg_clus)
# L-shaped clusters
layout <- matrix(c(1, 0, 0,
1, 0, 0,
1, 0, 0,
1, 1, 1), nrow = 4, byrow = TRUE);
# Cross
layout <- matrix(c(0, 1, 0,
1, 1, 1,
0, 1, 1), nrow = 3);
# Export to Shapefile
rgdal::writeOGR(gsg_cl, "gsg_clus.shp", driver = "ESRI Shapefile", layer = "gsg_clus");
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.