GeoJSONType - daneden/Twift GitHub Wiki
GeoJSONType
public enum GeoJSONType: String, Codable
Inheritance
Codable
, String
Enumeration Cases
Feature
A Feature object represents a spatially bounded thing.
case Feature
FeatureCollection
A GeoJSON object with the type "FeatureCollection" is a FeatureCollection object.
case FeatureCollection
A FeatureCollection object has a member with the name "features". The value of "features" is a JSON array. Each element of the array is a Feature object as defined above. It is possible for this array to be empty.
Point
For type "Point", the "coordinates" member is a single position.
case Point
MultiPoint
For type "MultiPoint", the "coordinates" member is an array of positions.
case MultiPoint
LineString
For type "LineString", the "coordinates" member is an array of two or more positions.
case LineString
MultiLineString
For type "MultiLineString", the "coordinates" member is an array of LineString coordinate arrays.
case MultiLineString
Polygon
To specify a constraint specific to Polygons, it is useful to introduce the concept of a linear ring:
case Polygon
-
A linear ring is a closed LineString with four or more positions.
-
The first and last positions 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. Note: the [GJ2008] specification did not discuss linear ring winding order. For backwards compatibility, parsers SHOULD NOT reject Polygons that do not follow the right-hand rule.
Though a linear ring is not explicitly represented as a GeoJSON geometry type, it leads to a canonical formulation of the Polygon geometry type definition as follows:
-
For type "Polygon", the "coordinates" member MUST be an array of linear ring coordinate arrays.
-
For Polygons with more than one of these rings, the first MUST be the exterior ring, and any others MUST be interior rings. The exterior ring bounds the surface, and the interior rings (if present) bound holes within the surface.
MultiPolygon
For type "MultiPolygon", the "coordinates" member is an array of Polygon coordinate arrays.
case MultiPolygon
GeometryCollection
A GeoJSON object with type "GeometryCollection" is a Geometry object.
case GeometryCollection
A GeometryCollection has a member with the name "geometries". The value of "geometries" is an array. Each element of this array is a GeoJSON Geometry object. It is possible for this array to be empty.