These terms adhere to RFC 7946 - The GeoJSON Format.
Sections
Definition
This class represents an immutable GeoJson Polygon
which may or may not include polygon holes.
To specify a constraint specific to Polygons, it is useful to introduce the concept of a linear ring:
A linear ring is a closed LineString with four or more coordinates.
The first and last coordinates are equivalent, and they MUST contain identical values; their representation SHOULD also be identical.
A linear ring is the boundary of a surface or the boundary of a hole in a surface.
A linear ring MUST follow the right-hand rule with respect to the area it bounds, i.e., exterior rings are counterclockwise, and holes are clockwise.
Currently no validations are handled. The following applies to future releases, which will enforce validations either by notification or automatic corrections.
Though a linear ring is not explicitly represented as a GeoJson geometry TYPE, it leads to a canonical formulation of the Polygon geometry TYPE. When initializing a new instance of this class, a LineString for the outer and optionally an inner are checked to ensure a valid linear ring.
Multiple Polygons become a MultiPolygon.
JSON Example & Class Diagram
Raw GeoJSON
{ "type": "Polygon", "coordinates": [ [ [100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0] ] ] }
Class Diagram
For complete & up to date information, see the API documentation. For a dynamic interactive diagram, see the FigJam diagram.
Input Assumptions
It is assumed that the first nested set of Positions describes the outer ring of the polygon, which is output by the outer
method. Any other sets of Positions are assumed to describe holes in the polygon, which are output by the inner
method.
Attachments:
Screen Shot 2023-11-08 at 5.42.14 PM.png (image/png)