Learn R Programming

PBSmapping (version 2.69.76)

placeHoles: Place Holes Under Correct Solids

Description

Place secondary polygons (SIDs) identified as holes (counter-clockwise rotation) under SIDs identified as solids (clockwise rotation) if the vertices of the holes lie completely within the vertices of the solids. This operation is performed for each primary polygon (PID).

Usage

placeHoles(polyset, minVerts=3)

Arguments

polyset

a valid PBSmapping PolySet.

minVerts

minimum number of vertices required for a polygon representing a hole to be retained (does not affect solids).

Value

Returns the input PolySet where SID holes have been arranged beneath appropriate SID solids for each PID.

Details

The algorith identifies the rotation of each polygon down to the SID level using the PBSmapping function .calcOrientation, where output values of 1 = solids (clockwise rotation) and -1 = holes (counter-clockwise rotation). Then for each solid, the function tests whether each hole occurs within the solid. To facilitate computation, the algorithm assumes that once a hole is located in a solid, it will not occur in any other solid. This means that for each successive solid, the number of candidate holes will either decrease or stay the same.

This function makes use of the point.in.polygon function contained in the package sp. For each hole vertex, the latter algorithm returns a numeric value: 0 = hole vertex is strictly exterior to the solid; 1 = hole vertex is strictly interior to the solid; 2 = hole vertex lies on the relative interior of an edge of the solid; 3 = hole vertex coincides with a solid vertex.

References

See copyright notice in point.in.polygon.

See Also

importShapefile, point.in.polygon