GeoJSON is a format for encoding a variety of geographic data structures. It is designed to be a spatial data interchange format that is easy for humans to read and write and easy for machines to parse and generate.

Basic Structure

A GeoJSON object represents a geometry or a collection of geometries. Here is a simple example of a GeoJSON object:

{
  "type": "FeatureCollection",
  "features": [
    {
      "type": "Feature",
      "properties": {
        "name": "Building 1"
      },
      "geometry": {
        "type": "Point",
        "coordinates": [102.0, 0.5]
      }
    },
    {
      "type": "Feature",
      "properties": {
        "name": "Building 2"
      },
      "geometry": {
        "type": "Point",
        "coordinates": [102.0, 0.6]
      }
    }
  ]
}

In this example, we have a FeatureCollection with two Feature objects. Each Feature has a properties object and a geometry object.

Geometry Types

GeoJSON supports several geometry types:

  • Point: A single location on the surface of the Earth.
  • LineString: A sequence of points that are connected in order.
  • Polygon: A closed LineString with an interior.
  • MultiPoint: A collection of Points.
  • MultiLineString: A collection of LineStrings.
  • MultiPolygon: A collection of Polygons.

Properties

Properties are key-value pairs that provide additional information about the feature. For example, in the previous example, the properties object contains a name key with the value "Building 1".

Coordinate Reference Systems

GeoJSON uses coordinate reference systems (CRS) to define the location of the geometry. The most common CRS is the Web Mercator projection, which is used by many online mapping services.

Resources

For more information about GeoJSON, please visit the GeoJSON website.

GeoJSON Example