create_Polys {CCAMLRGIS}R Documentation

Create Polygons

Description

Create Polygons such as proposed Research Blocks or Marine Protected Areas.

Usage

create_Polys(
  Input,
  NamesIn = NULL,
  Buffer = 0,
  Densify = TRUE,
  Clip = FALSE,
  SeparateBuf = TRUE
)

Arguments

Input

input dataframe.

If NamesIn is not provided, the columns in the Input must be in the following order:

Polygon name, Latitude, Longitude.

Latitudes and Longitudes must be given clockwise.

NamesIn

character vector of length 3 specifying the column names of polygon identifier, Latitude and Longitude fields in the Input.

Names must be given in that order, e.g.:

NamesIn=c('Polygon ID','Poly Latitudes','Poly Longitudes').

Buffer

numeric, distance in nautical miles by which to expand the polygons. Can be specified for each polygon (as a numeric vector).

Densify

logical, if set to TRUE, additional points between extremities of lines spanning more than 0.1 degree longitude are added at every 0.1 degree of longitude prior to projection (compare examples 1 and 2 below).

Clip

logical, if set to TRUE, polygon parts that fall on land are removed (see Clip2Coast).

SeparateBuf

logical, if set to FALSE when adding a Buffer, all spatial objects are merged, resulting in a single spatial object.

Value

Spatial object in your environment. Data within the resulting spatial object contains the data provided in the Input after aggregation within polygons. For each numeric variable, the minimum, maximum, mean, sum, count, standard deviation, and, median of values in each polygon is returned. In addition, for each polygon, its area (AreaKm2) and projected centroid (Labx, Laby) are given (which may be used to add labels to polygons).

To see the data contained in your spatial object, type: View(MyPolygons).

See Also

create_Points, create_Lines, create_PolyGrids, create_Stations, add_RefGrid, add_Legend.

Examples



# For more examples, see:
# https://github.com/ccamlr/CCAMLRGIS#create-polygons


#Densified polygons (note the curvature of lines)

MyPolys=create_Polys(Input=PolyData)
plot(st_geometry(MyPolys),col='red')
text(MyPolys$Labx,MyPolys$Laby,MyPolys$ID,col='white')





[Package CCAMLRGIS version 4.1.1 Index]