Skip to content

Latest commit

 

History

History
224 lines (173 loc) · 6.41 KB

File metadata and controls

224 lines (173 loc) · 6.41 KB

Geometry Examples

Each of the examples below represents a valid and complete GeoJSON object.

Points

Point coordinates are in x, y order (easting, northing for projected coordinates, longitude, latitude for geographic coordinates):

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

LineStrings

Coordinates of LineString are an array of positions (see ):

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

Polygons

Coordinates of a Polygon are an array of LinearRing (see ) coordinate arrays. The first element in the array represents the exterior ring. Any subsequent elements represent interior rings (or holes).

No holes:

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

With holes:

  {
      "type": "Polygon",
      "coordinates": [
          [
              [100.0, 0.0],
              [100.0, 1.0],
              [101.0, 1.0],
              [101.0, 0.0],
              [100.0, 0.0]
          ],
          [
              [100.8, 0.8],
              [100.2, 0.8],
              [100.2, 0.2],
              [100.8, 0.2],
              [100.8, 0.8]
          ]
      ]
  }

MultiPoints

Coordinates of a MultiPoint are an array of positions::

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

MultiLineStrings

Coordinates of a MultiLineString are an array of LineString coordinate arrays:

  {
      "type": "MultiLineString",
      "coordinates": [
          [
              [100.0, 0.0],
              [101.0, 1.0]
          ],
          [
              [102.0, 2.0],
              [103.0, 3.0]
          ]
      ]
  }

MultiPolygons

Coordinates of a MultiPolygon are an array of Polygon coordinate arrays:

  {
      "type": "MultiPolygon",
      "coordinates": [
          [
              [
                  [102.0, 2.0],
                  [102.0, 3.0],
                  [103.0, 3.0],
                  [103.0, 2.0],
                  [102.0, 2.0]
              ]
          ],
          [
              [
                  [100.0, 0.0],
                  [100.0, 1.0],
                  [101.0, 1.0],
                  [101.0, 0.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]
              ]
          ]
      ]
  }

GeometryCollections

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

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

Changes from pre-IETF specification

This appendix briefly summarizes non-editorial changes from the 2008 specification [GJ2008].

Normative changes

  • Coordinate reference systems other than the default are NOT RECOMMENDED (see ).

  • In the absence of elevation values, applications sensitive to height or depth SHOULD interpret positions as being at local ground or sea level (see ).

  • Implementations SHOULD NOT extend position arrays beyond 3 elements (see ).

  • A line between two positions is a straight Cartesian line (see ).

  • The values of a "bbox" array are [%west%, %south%, %east%, %north%], not [%minx%, %miny%, %maxx%, %maxy%] (see ).

  • A Feature object's "id" member is a string or number (see ).

  • Extensions MAY be used, but MUST NOT change the the semantics of GeoJSON members and types (see ).

  • GeoJSON objects MUST NOT contain the defining members of other types (see ).

  • The media type for GeoJSON is application/geo+json.

Informative changes

  • The definition of a GeoJSON text has been added.

  • Rules for mapping 'geo' URIs have been added.

  • A recommendation of the I-JSON [RFC7493] constraints has been added.

  • Implementers are cautioned about the effect of excessive coordinate precision on interoperability.

  • Right-hand rule orientation of polygon rings (counter-clockwise external rings, clockwise internal rings) is recommended to improve interoperability.

  • Interoperability concerns of geometry collections are noted. These objects should be used sparingly (see ).

GeoJSON Text Sequences

All GeoJSON objects defined in this specification - FeatureCollection, Feature, and Geometry - consist of exactly one JSON object. However, there may be circumstances in which applications need to represent sets or sequences of these objects (over and above the grouping of Feature objects in a FeatureCollection), e.g. in order to efficiently "stream" large numbers of Feature objects. The definition of such sets or sequences is outside the scope of this specification.

If such a representation is needed, a new media type is required that has the ability to represent these sets or sequences. When defining such a media type, it may be useful to base it on "JSON Text Sequences" [RFC7464], leaving the foundations of how to represent multiple JSON objects to that specification, and only defining how it applies to GeoJSON objects.

Contributors

The GeoJSON format is the product of discussion on the GeoJSON mailing list, http://lists.geojson.org/listinfo.cgi/geojson-geojson.org, before October 2015 and the IETF's GeoJSON WG after October 2015.

Comments are solicited and should be addressed to the GeoJSON mailing list at geojson@ietf.org or to the GeoJSON issue tracker at https://github.com/geojson/draft-geojson/issues.