Commit 2daf88e9 authored by Daniela Rabe's avatar Daniela Rabe
Browse files

Merge branch 'save_samplepoints' into 'master'

Save samplepoints

See merge request !32
parents d44137fb 884fe901
Pipeline #37449 passed with stages
in 15 minutes and 18 seconds
......@@ -66,7 +66,7 @@ save_kml <- function(outPath, step, raster, overwrite) {
#' @param output_format format (character) of output; whether shp (default) or geojson
#' @param ref_samples list of reference sample points
#' @param ref_switch vector with switch values
#' @param num_models number of models used for the classification of a habitat
#' @param num_models threshold + number of models used for the classification of a habitat
#' @param dummy_raster raster with probabilities for each pixel
#' @param overwrite overwrite file (default TRUE)
#'
......@@ -83,13 +83,14 @@ saveSamplePoints <-
output_format = c("shp", "geojson"),
ref_samples,
ref_switch,
num_models,
num_models, # threshold + num_models
dummy_raster,
overwrite = TRUE) {
collect <- list()
j <- 0
dummy_raster[dummy_raster == num_models] <- NA
dummy_raster[dummy_raster > num_models] <- 1
dummy_raster[dummy_raster < num_models] <- NA
dummy_raster[dummy_raster >= num_models] <- 1
###extract only class samples
for (i in 1:length(ref_samples)) {
......@@ -106,7 +107,7 @@ saveSamplePoints <-
}
}
}
result <- do.call(rbind, collect)
if (!is.null(result)) {
res <- raster::extract(dummy_raster, result)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment