Description Usage Arguments Value Examples
View source: R/sample_raster.R
Useful for gathering training data for an image classification. With the default settings, the output polygons will be perfectly aligned with the pixels in the input raster.
1 2 | sample_raster(x, size, strata = NULL, side = xres(x), fields = c(),
na.rm = TRUE, exp = 5)
|
x |
a |
size |
the sample size (number of sample polygons to return) |
strata |
(optional) a |
side |
desired length for each side of the sample polygon (units of the
input |
fields |
a list of fields to include in the output
|
na.rm |
whether to remove pixels with NA values from the sample |
exp |
multiplier used to draw larger initial sample to account for the loss of sample polygons lost because they contain NAs, and, for stratified sampling, to account for classes that occur very infrequently in the data. Increase this value if the final sample has fewer sample polygons than desired. |
a SpatialPolygonsDataFrame
1 2 3 4 5 6 7 8 9 | ## Not run:
set.seed(0)
L5TSR_1986_b1 <- raster(L5TSR_1986, layer=1)
training_polys <- sample_raster(L5TSR_1986_b1, 30,
side=6*xres(L5TSR_1986_b1))
plot(L5TSR_1986_b1)
plot(training_polys, add=TRUE)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.