Commit bfd31676 authored by Johannes Knoch's avatar Johannes Knoch
Browse files

renamed the function and output names and put in missing packages for functions used

parent 865d2f66
# Generated by roxygen2: do not edit by hand
export(WriteOutSamples)
export(clip)
export(iplot)
export(load_reference_as_shape)
......@@ -12,5 +13,4 @@ export(sample_nb)
export(save_class_tiff)
export(save_kml)
export(save_run)
export(write_Out_Samples)
exportClasses(Habitat)
......@@ -7,14 +7,14 @@
#' @param className name (character) of habitat type for which samples should be selected
#' @param output_format format (character) of output; whether shp (default) or geojson
#'
#' @return ESRI shapefiles/GeoJSON with name: RefHaSa_step_classname.shp/RefHaSa_step_classname.geojson
#' 1) Point Shape represents pixel that belong to selected habitat type and can be used as reference for further model building
#' @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
#'
#'
#' @export
###write out selected samples
write_Out_Samples <- function (inPath, step, className, output_format = c("shp", "geojson")) {
WriteOutSamples <- function (inPath, step, className, output_format = c("shp", "geojson")) {
paste(inPath, "step_", step, "_", className, ".tif", sep = "")
run1 <- get(load(paste(inPath, "Run", step, sep = "")))
......@@ -59,26 +59,26 @@ write_Out_Samples <- function (inPath, step, className, output_format = c("shp",
if (output_format == "geojson") {
crs_dummy <- sp::proj4string(dummy_sample)
crs(res) <- crs_dummy
raster::crs(res) <- crs_dummy
res <- sp::spTransform(res, CRS("+proj=longlat +datum=WGS84 +init=epsg:4326"))
rgdal::writeOGR(
res,
layer = paste("RefHaSa_step_", step, "_", className, sep = ""),
dsn = paste(inPath, "RefHaSa_step_", step, "_", className, ".geojson", sep = ""),
layer = paste("SamplePoints_step_", step, "_", className, sep = ""),
dsn = paste(inPath, "SamplePoints_step_", step, "_", className, ".geojson", sep = ""),
driver = "GeoJSON",
check_exists = TRUE,
overwrite_layer = TRUE
)
} else {
crs_dummy <- sp::proj4string(dummy_sample)
crs(res) <- crs_dummy
raster::crs(res) <- crs_dummy
res <- sp::spTransform(res, CRS("+proj=longlat +datum=WGS84 +init=epsg:4326"))
rgdal::writeOGR(
res,
layer = paste("RefHaSa_step_", step, "_", className, sep = ""),
dsn = paste(inPath, "RefHaSa_", className, "_", step, ".shp", sep = ""),
layer = paste("SamplePoints_step_", step, "_", className, sep = ""),
dsn = paste(inPath, "SamplePoints_step_", step, "_", className, ".shp", sep = ""),
driver = "ESRI Shapefile",
check_exists = TRUE,
overwrite_layer = TRUE
......
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/WriteOutSamples.r
\name{write_Out_Samples}
\alias{write_Out_Samples}
\name{WriteOutSamples}
\alias{WriteOutSamples}
\title{Sample Collection for Habitat Types}
\usage{
write_Out_Samples(inPath, step, className, output_format = c("shp", "geojson"))
WriteOutSamples(inPath, step, className, output_format = c("shp", "geojson"))
}
\arguments{
\item{inPath}{file path (character) for results of habitat type sampling and probability mapping (same as outPath from function multi_Class_Sampling)}
......@@ -16,9 +16,9 @@ write_Out_Samples(inPath, step, className, output_format = c("shp", "geojson"))
\item{output_format}{format (character) of output; whether shp (default) or geojson}
}
\value{
ESRI shapefiles/GeoJSON with name: RefHaSa_step_classname.shp/RefHaSa_step_classname.geojson
ESRI shapefiles/GeoJSON with name: SamplePoints_step_classname.shp/SamplePoints_step_classname.geojson
\enumerate{
\item Point Shape represents pixel that belong to selected habitat type and can be used as reference for further model building
\item Point Shape/GeoJSON represents pixel that belong to selected habitat type and can be used as reference for further model building
}
}
\description{
......
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