data-types: Description of GeoJSON data types

Description GeoJSON object Geometry Point MultiPoint Polygon MultiPolygon LineString MultiLineString Feature FeatureCollection GeometryCollection

Description

GeoJSON types based on

GeoJSON object

GeoJSON always consists of a single object. This object (referred to as the GeoJSON object below) represents a geometry, feature, or collection of features.

Geometry

A Geometry object represents points, curves, and surfaces in coordinate space. Every Geometry object is a GeoJSON object no matter where it occurs in a GeoJSON text.

Point

For type "Point", the "coordinates" member must be a single position.

Example JSON: { "type": "Point", "coordinates": [100.0, 0.0] }

In lawn: lawn_point(c(1, 2))

See: lawn_point

MultiPoint

For type "MultiPoint", the "coordinates" member must be an array of positions.

Example JSON: { "type": "MultiPoint", "coordinates": [ [100.0, 0.0], [101.0, 1.0] ] }

See: lawn_multipoint

Polygon

For type "Polygon", the "coordinates" member must be an array of LinearRing coordinate arrays. For Polygons with multiple rings, the first must be the exterior ring and any others must be interior rings or holes.

Example JSON: { "type": "Polygon", "coordinates": [ [ [100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0] ]] }

In lawn: lawn_polygon(list(list(c(-2, 52), c(-3, 54), c(-2, 53), c(-2, 52))))

See: lawn_polygon

MultiPolygon

For type "MultiPolygon", the "coordinates" member must be an array of Polygon coordinate arrays.

Example JSON:

{ "type": "MultiPolygon", "coordinates": [ [[[102.0, 2.0], [103.0, 2.0], [103.0, 3.0], [102.0, 3.0], [102.0, 2.0]]], [[[100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0]], [[100.2, 0.2], [100.8, 0.2], [100.8, 0.8], [100.2, 0.8], [100.2, 0.2]]] ] }

See: lawn_multipolygon

LineString

For type "LineString", the "coordinates" member must be an array of two or more positions. A LinearRing is closed LineString with 4 or more positions. The first and last positions are equivalent (they represent equivalent points). Though a LinearRing is not explicitly represented as a GeoJSON geometry type, it is referred to in the Polygon geometry type definition.

Example JSON: { "type": "LineString", "coordinates": [ [100.0, 0.0], [101.0, 1.0] ] }

In lawn: lawn_linestring(list(c(-2, 52), c(-3, 54), c(-2, 53)))

See: lawn_linestring

MultiLineString

For type "MultiLineString", the "coordinates" member must be an array of LineString coordinate arrays.

Example JSON: { "type": "MultiLineString", "coordinates": [ [[ -105, 39 ], [ -105, 39 ]], [[ -105, 39 ], [ -105, 39 ]] ] }

See: lawn_multilinestring

Feature

A GeoJSON object with the type "Feature" is a feature object:

See: lawn_feature

FeatureCollection

A GeoJSON object with the type "FeatureCollection" is a feature collection object. An object of type "FeatureCollection" must have a member with the name "features". The value corresponding to "features" is an array. Each element in the array is a feature object as defined above.

In lawn: lawn_featurecollection(lawn_point(c(-75, 39)))

See: lawn_featurecollection

GeometryCollection

Each element in the geometries array of a GeometryCollection is one of the geometry objects described above.

Example JSON: { "type": "GeometryCollection", "geometries": [ { "type": "Point", "coordinates": [100.0, 0.0] }, { "type": "LineString", "coordinates": [ [101.0, 0.0], [102.0, 1.0] ] } ] }

See: lawn_geometrycollection


lawn documentation built on Jan. 6, 2021, 5:07 p.m.