Commit 6f04501a authored by Romulo Pereira Goncalves's avatar Romulo Pereira Goncalves
Browse files

Merge branch 'issue#27' into 'master'

fixes issue#27

Closes #27

See merge request !16
parents d2a87c9a e4537dae
Pipeline #24378 passed with stages
in 10 minutes and 27 seconds
...@@ -92,17 +92,17 @@ multi_Class_Sampling <- function(in.raster, ...@@ -92,17 +92,17 @@ multi_Class_Sampling <- function(in.raster,
max_num_cores = 5, max_num_cores = 5,
plot_on_browser = TRUE) { plot_on_browser = TRUE) {
# Checks if its a new or a resumed run and asks the user to remove all .tif # Checks if its a new or a resumed run and asks the user to remove all step_*.tif
# files from the results folder in case of a new run. # files from the results folder in case of a new run.
if(step == 1){ if(step == 1){
if (length(list.files( if (length(list.files(
outPath, outPath,
pattern = ".tif$", pattern = "step_(.*).tif",
all.files = FALSE, all.files = FALSE,
include.dirs = TRUE, include.dirs = TRUE,
no.. = TRUE no.. = TRUE
)) != 0) { )) != 0) {
message("Remove all .tif files from the Results directory! Don't forget to save them and the other files. message("Remove all step_*.tif files from the Results directory! Don't forget to save them and the other files.
All other files will be overwriten when a new sampling is started.") All other files will be overwriten when a new sampling is started.")
return(NULL) return(NULL)
} }
...@@ -518,7 +518,7 @@ multi_Class_Sampling <- function(in.raster, ...@@ -518,7 +518,7 @@ multi_Class_Sampling <- function(in.raster,
kml <- raster::projectRaster(dummy, kml <- raster::projectRaster(dummy,
crs = "+proj=longlat +datum=WGS84", crs = "+proj=longlat +datum=WGS84",
method = 'ngb') method = 'ngb')
raster::KML(kml, paste(outPath, paste("step_", ni, sep = ""), sep = ""), overwrite = overwrite) raster::KML(kml, paste(outPath, paste("step_", ni, sep = ""), sep = ""), overwrite = overwrite, zip = FALSE)
thres <- as.numeric(decision) thres <- as.numeric(decision)
thres <- thres + num_models thres <- thres + num_models
......
...@@ -12,23 +12,23 @@ ...@@ -12,23 +12,23 @@
#' #'
#' @export #' @export
plot_results <- function(inPath, color = NULL) { plot_results <- function(inPath, color = NULL) {
# Compares the number of .kmz to that of .tif. If .tif files are missing the # Compares the number of .png to that of step_*.tif. If step_*.tif files are missing the
# user's attention is drawn. # user's attention is drawn.
if (length(list.files( if (length(list.files(
inPath, inPath,
pattern = ".tif$", pattern = "step_(.*).tif",
all.files = FALSE, all.files = FALSE,
include.dirs = TRUE, include.dirs = TRUE,
no.. = TRUE no.. = TRUE
)) != length(list.files( )) != length(list.files(
inPath, inPath,
pattern = ".kmz$", pattern = ".png$",
all.files = FALSE, all.files = FALSE,
include.dirs = TRUE, include.dirs = TRUE,
no.. = TRUE no.. = TRUE
))) { ))) {
message("Make sure the number of the .tif files fits to the number of the .kmz files and that message("Make sure the number of the step_*.tif files fits to the number of the .png files and that
there are no other files from previous runs. there are no other files from previous runs.
If you have resumed a run, then the data of the aborted and the continued run needs If you have resumed a run, then the data of the aborted and the continued run needs
to be in the Results directory. You need them for plotting the classification map.") to be in the Results directory. You need them for plotting the classification map.")
......
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