#' @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 threshold threshold
#' @param num_models number of models used for the classification of a habitat
#' @param dummy_raster raster with probabilities for each pixel
#'
#' @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 the pixels which were used to train the models for that habitat.
#' ESRI shapefiles have the same CRS as the input raster. GeoJSON files are in the standard CRS of GeoJSON (EPSG:4326).
#'
#'
...
...
@@ -82,13 +82,13 @@ saveSamplePoints <-
output_format=c("shp","geojson"),
ref_samples,
ref_switch,
threshold,
num_models,
dummy_raster){
collect<-list()
j<-0
dummy_raster[dummy_raster<threshold]<-NA
dummy_raster[dummy_raster>=threshold]<-1
dummy_raster[dummy_raster==num_models]<-NA
dummy_raster[dummy_raster>num_models]<-1
###extract only class samples
for(iin1:length(ref_samples)){
if(length(dim(ref_samples[[i]]))!=0)
...
...
@@ -113,6 +113,7 @@ saveSamplePoints <-
result<-result[-which(is.na(res)),]
}
raster::crs(result)<-raster::crs(dummy_raster)
output_format<-match.arg(output_format)
if(output_format=="geojson"){
# Only transform is there points to be saved.
...
...
@@ -140,9 +141,11 @@ saveSamplePoints <-
}
#' Sample Collection for Habitat Types
#' Selected Sample Collection for Habitat Types
#'
#'Writes out a set of samples (SpatialPointsDataFrame) into ESRI shapefiles or a GeoJSON file for a selected habitat type. Each point represents a valid sample location that identifies the selected habitat type.
#' Writes out a set of samples (SpatialPointsDataFrame) into ESRI shapefiles or a GeoJSON file for a selected habitat type.
#' Each point represents a valid sample location that identifies the selected habitat type. Only those points are selected
#' which lay in the habitat type selected by the user's input threshold.
#'
#' @param in_path file path (character) for results of habitat type sampling and probability mapping (same as outPath from function multi_Class_Sampling)
#' @param step step number (numeric)
...
...
@@ -150,7 +153,7 @@ saveSamplePoints <-
#' @param output_format format (character) of output; whether shp (default) or 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 the pixels which belong to selected habitat type and can be used as reference for further model building.
#' ESRI shapefiles have the same CRS as the input raster. GeoJSON files are in the standard CRS of GeoJSON (EPSG:4326).