Commit ccc3e7b9 authored by Romulo Pereira Goncalves's avatar Romulo Pereira Goncalves
Browse files

The filter, like in other save functions should be done inside the function.

parent 1c5b3001
...@@ -66,7 +66,8 @@ save_kml <- function(outPath, step, raster, overwrite) { ...@@ -66,7 +66,8 @@ save_kml <- function(outPath, step, raster, overwrite) {
#' @param output_format format (character) of output; whether shp (default) or geojson #' @param output_format format (character) of output; whether shp (default) or geojson
#' @param ref_samples list of reference sample points #' @param ref_samples list of reference sample points
#' @param ref_switch vector with switch values #' @param ref_switch vector with switch values
#' @param dummy_raster raster with classified pixels marked as 1 #' @param threshold threshold
#' @param dummy_raster raster with probabilities for each pixel
#' #'
#' @return ESRI shapefiles/GeoJSON with name: SamplePoints_step_classname.shp/SamplePoints_step_classname.geojson #' @return ESRI shapefiles/GeoJSON with name: SamplePoints_step_classname.shp/SamplePoints_step_classname.geojson
#' 1) Point Shape/GeoJSON represents pixel that belong to selected habitat type and can be used as reference for further model building. #' 1) Point Shape/GeoJSON represents pixel that belong to selected habitat type and can be used as reference for further model building.
...@@ -81,9 +82,12 @@ saveSamplePoints <- ...@@ -81,9 +82,12 @@ saveSamplePoints <-
output_format = c("shp", "geojson"), output_format = c("shp", "geojson"),
ref_samples, ref_samples,
ref_switch, ref_switch,
threshold,
dummy_raster) { dummy_raster) {
collect <- list() collect <- list()
j <- 0 j <- 0
dummy_raster[dummy_raster < threshold] <- NA
dummy_raster[dummy_raster >= threshold] <- 1
###extract only class samples ###extract only class samples
for (i in 1:length(ref_samples)) { for (i in 1:length(ref_samples)) {
......
...@@ -11,6 +11,7 @@ saveSamplePoints( ...@@ -11,6 +11,7 @@ saveSamplePoints(
output_format = c("shp", "geojson"), output_format = c("shp", "geojson"),
ref_samples, ref_samples,
ref_switch, ref_switch,
threshold,
dummy_raster dummy_raster
) )
} }
...@@ -27,7 +28,9 @@ saveSamplePoints( ...@@ -27,7 +28,9 @@ saveSamplePoints(
\item{ref_switch}{vector with switch values} \item{ref_switch}{vector with switch values}
\item{dummy_raster}{raster with classified pixels marked as 1} \item{threshold}{threshold}
\item{dummy_raster}{raster with probabilities for each pixel}
} }
\value{ \value{
ESRI shapefiles/GeoJSON with name: SamplePoints_step_classname.shp/SamplePoints_step_classname.geojson ESRI shapefiles/GeoJSON with name: SamplePoints_step_classname.shp/SamplePoints_step_classname.geojson
......
Markdown is supported
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