Function File: [Xo, Yo, ... ] = closePolygonParts (Xi, Yi, ...)
Function File: [Xo, Yo, ... ] = closePolygonParts (Xi, Yi, ..., angunit)

Ensure that (each part of a multipart) polygon is a closed ring.

For each (part of a) polygon, closePolygonParts checks if the vertices of that part form a closed ring, i.e., if first and last vertices coincide. If the polygon or polygon parts (the latter separated separated by NaNs) do not form a closed ring, the first vertex coordinates of each open part are appended after its last vertex. Input polygons need not be multipart.

Xi and Yi (plus optionally, Zi and/or Mi) are input vectors of X and Y or Longitude and Latitude (plus optionally Z or Height, and/or M) vectors of vertex coordinates (and measure values) of an input polygon. If a vector of measures is given as argument, it should always be the last vector.

Optional last argument angunit can be one of ’Degrees’ or ’Radians’ (case-insensitive, only the first 3 characters need to match). If this argument is given and if the first two input vectors are longitude/latitude vectors rather than X/Y vectors, it indicates that the longitudes of those first and last vectors need only coincide modulo 360 degrees or 2*pi radians.

The number of output vectors Xo, Yo, ... matches the number of input vectors.

See also: isShapeMultiPart.

Package: mapping