DefineStratumPolygon: Define stratum multipolygon

View source: R/Spatial.R

DefineStratumPolygonR Documentation

Define stratum multipolygon

Description

This function reads a GeoJSON file, shapefile or a StoX_multipolygon_WKT file and returns an object of StoX data type StratumPolygon file.

Usage

DefineStratumPolygon(
  processData,
  UseProcessData = FALSE,
  DefinitionMethod = c("Manual", "ResourceFile"),
  FileName = character(),
  StratumNameLabel = character(),
  SimplifyStratumPolygon = FALSE,
  SimplificationFactor = 1
)

Arguments

processData

The current data produced by a previous instance of the function.

UseProcessData

Logical: If TRUE use the existing function output in the process.

DefinitionMethod

A string naming the method to use, one of "Manual" to start off with no strata and create the strata manually in the map of the StoX GUI. Strata can be added, modified and removed in the StoX GUI; or "ResourceFile", to read the file FileName holding the stratum multipolygon.

FileName

The path to a GeoJSON file, shapefile, use the file with extension "shp" (may be a folder containing the shapefiles); a StoX_multipolygon_WKT file; or a project.xml file from StoX <= 2.7. Note that in the latter case it is assumed that the contents of the project.xml file is actually used in the StoX <= 2.7 project, i.e. that UseProcessData = TRUE in DefineStrata(). Must include file extension.

StratumNameLabel

The name of the attribute representing the stratum names in the GeoJSON file or shapefile.

SimplifyStratumPolygon

Logical: If TRUE a simplification algorithm is applied to the stratum polygons (sf::st_simplify(), which "uses the GEOS implementation of the Douglas-Peucker algorithm to reduce the vertex count" as per quote from Geocomputation with R). This option is useful for very complex stratum polygon files to reduce time for opening, running and saving a project.

SimplificationFactor

A value between 0 and 1 specifying the desired object size of the stratum polygon after simplification. An iterative method is used to derive the to the desired object size. Strata that end up as empty strata after simplification are left un-simplified, and will contribute to a larger final object size than the desired object size. Note that larger values require more time than smaller values. It is advisable to start with a low value (e.g. 0.01) and check the resolution of the strata borders in the map, and gradually increase SimplificationFactor until an acceptable resolution is obtained. Note that simplification of stratum polygons can lead to inaccuracies such as gaps between strata, which can lead to hauls falling outside of any stratum, causing under-estimation of survey indices, or failure to complete the model in the case of SplitNASC models which require all hauls to be located in a stratum. If such problems occur, the strata can be modified manually after simplification to include all hauls. Another problem is the change in stratum areas, which is reported to the console when running the simplification. A very rough rule of thumb is that SimplificationFactor = 0.1 seems to be a compromise between increased speed and reduction of stratum border resolution.

Details

The parameter UseProcessData is always set to TRUE when running a process, and needs to be explicitely set to FALSE to enable reading a file (It's set to FALSE at the moment).

Polygons are expected to have the the following projection: getRstoxBaseDefinitions("proj4string_longlat")

Value

An object of StoX data type StratumPolygon.

References

Additonal information on GeoJSON and shapefiles specification can be found here: https://geojson.org/

https://doc.arcgis.com/en/arcgis-online/reference/shapefiles.htm

See Also

StratumArea for calculating the area of the strata.


StoXProject/RstoxBase documentation built on July 14, 2024, 9:39 a.m.