GeoJSON Examples

Browse common GeoJSON examples for Point LineString Polygon and FeatureCollection types.

Point

A single position. Use for markers, addresses, POIs, or any discrete location.

GeoJSON{
  "type": "Point",
  "coordinates": [-73.9857, 40.7484]
}

Coordinates are [longitude, latitude] and optionally [longitude, latitude, altitude].

MultiPoint

Multiple positions in a single geometry.

GeoJSON{
  "type": "MultiPoint",
  "coordinates": [
    [-73.9857, 40.7484],
    [-118.2437, 34.0522],
    [-87.6298, 41.8781]
  ]
}

LineString

A sequence of two or more connected points. Use for routes, roads, rivers, or any linear feature.

GeoJSON{
  "type": "LineString",
  "coordinates": [
    [-122.4194, 37.7749],
    [-118.2437, 34.0522],
    [-115.1398, 36.1699]
  ]
}

A LineString must have at least two positions.

MultiLineString

Multiple line strings in a single geometry. Use for route networks or disconnected paths.

GeoJSON{
  "type": "MultiLineString",
  "coordinates": [
    [
      [-122.4194, 37.7749],
      [-118.2437, 34.0522]
    ],
    [
      [-87.6298, 41.8781],
      [-84.3880, 33.7490]
    ]
  ]
}

Polygon

A closed area defined by a linear ring. The first and last coordinate must be identical to close the ring. Use for boundaries, buildings, parcels, or any area.

GeoJSON{
  "type": "Polygon",
  "coordinates": [
    [
      [-104.05, 48.99],
      [-97.22, 48.98],
      [-96.58, 45.94],
      [-104.03, 45.94],
      [-104.05, 48.99]
    ]
  ]
}

The outer ring follows counter-clockwise winding order per RFC 7946.

Polygon with Hole

A polygon can contain holes (interior rings). The first array is the exterior ring; subsequent arrays are holes with clockwise winding order.

GeoJSON{
  "type": "Polygon",
  "coordinates": [
    [
      [-109.05, 41.00],
      [-102.06, 41.00],
      [-102.06, 37.00],
      [-109.05, 37.00],
      [-109.05, 41.00]
    ],
    [
      [-107.0, 40.0],
      [-105.0, 40.0],
      [-105.0, 38.0],
      [-107.0, 38.0],
      [-107.0, 40.0]
    ]
  ]
}

MultiPolygon

Multiple polygons in a single geometry. Use for countries with islands, discontiguous territories, or any multi-part area.

GeoJSON{
  "type": "MultiPolygon",
  "coordinates": [
    [
      [
        [-117.2, 32.7],
        [-117.1, 32.7],
        [-117.1, 32.8],
        [-117.2, 32.8],
        [-117.2, 32.7]
      ]
    ],
    [
      [
        [-118.3, 33.9],
        [-118.2, 33.9],
        [-118.2, 34.0],
        [-118.3, 34.0],
        [-118.3, 33.9]
      ]
    ]
  ]
}

GeometryCollection

A collection of different geometry types in a single object.

GeoJSON{
  "type": "GeometryCollection",
  "geometries": [
    {
      "type": "Point",
      "coordinates": [-73.9857, 40.7484]
    },
    {
      "type": "LineString",
      "coordinates": [
        [-73.9857, 40.7484],
        [-73.9712, 40.7831]
      ]
    }
  ]
}

GeometryCollections are rarely used in practice — a FeatureCollection with separate Features is usually more practical.

Feature

A Feature wraps a geometry with a properties object for non-spatial attributes. This is the standard way to attach metadata to geometries.

GeoJSON{
  "type": "Feature",
  "geometry": {
    "type": "Point",
    "coordinates": [-73.9857, 40.7484]
  },
  "properties": {
    "name": "Empire State Building",
    "height": 443.2,
    "floors": 102,
    "year_built": 1931
  }
}

The properties member can contain any valid JSON. It can also be null.

Feature with ID

Features can have an optional id member at the top level. Per RFC 7946, the value should be either a string or a number.

GeoJSON{
  "type": "Feature",
  "id": "building-123",
  "geometry": {
    "type": "Point",
    "coordinates": [-73.9857, 40.7484]
  },
  "properties": {
    "name": "Empire State Building"
  }
}

Feature with Null Geometry

A Feature's geometry can be null to represent a feature with properties but no location. This is valid GeoJSON.

GeoJSON{
  "type": "Feature",
  "geometry": null,
  "properties": {
    "name": "Atlantis",
    "status": "unlocated"
  }
}

FeatureCollection

The most common top-level GeoJSON object. Contains an array of Features, which can have different geometry types.

GeoJSON{
  "type": "FeatureCollection",
  "features": [
    {
      "type": "Feature",
      "geometry": {
        "type": "Point",
        "coordinates": [-73.9857, 40.7484]
      },
      "properties": {
        "name": "Empire State Building",
        "type": "landmark"
      }
    },
    {
      "type": "Feature",
      "geometry": {
        "type": "Polygon",
        "coordinates": [
          [
            [-73.9876, 40.7661],
            [-73.9810, 40.7661],
            [-73.9810, 40.7623],
            [-73.9876, 40.7623],
            [-73.9876, 40.7661]
          ]
        ]
      },
      "properties": {
        "name": "Central Park South Edge",
        "type": "park"
      }
    }
  ]
}

Bounding Box

Any GeoJSON object can include a bbox member to describe the spatial extent. The format is [west, south, east, north].

GeoJSON{
  "type": "FeatureCollection",
  "bbox": [-74.0, 40.7, -73.9, 40.8],
  "features": [
    {
      "type": "Feature",
      "geometry": {
        "type": "Point",
        "coordinates": [-73.9857, 40.7484]
      },
      "properties": { "name": "Empire State Building" }
    }
  ]
}

For 3D data, use [west, south, min-altitude, east, north, max-altitude].

3D Coordinates (with Altitude)

GeoJSON supports an optional third coordinate for altitude (in meters above the WGS 84 ellipsoid).

GeoJSON{
  "type": "Feature",
  "geometry": {
    "type": "Point",
    "coordinates": [-105.0, 39.74, 1609]
  },
  "properties": {
    "name": "Denver",
    "note": "The Mile High City — 1609 meters elevation"
  }
}

Real-World Example: Store Locations

A practical example of multiple stores with properties:

GeoJSON{
  "type": "FeatureCollection",
  "features": [
    {
      "type": "Feature",
      "geometry": {
        "type": "Point",
        "coordinates": [-122.4194, 37.7749]
      },
      "properties": {
        "name": "San Francisco Store",
        "address": "123 Market St",
        "open": true,
        "rating": 4.5
      }
    },
    {
      "type": "Feature",
      "geometry": {
        "type": "Point",
        "coordinates": [-118.2437, 34.0522]
      },
      "properties": {
        "name": "Los Angeles Store",
        "address": "456 Wilshire Blvd",
        "open": true,
        "rating": 4.2
      }
    },
    {
      "type": "Feature",
      "geometry": {
        "type": "Point",
        "coordinates": [-115.1398, 36.1699]
      },
      "properties": {
        "name": "Las Vegas Store",
        "address": "789 Las Vegas Blvd",
        "open": false,
        "rating": 3.8
      }
    }
  ]
}

Further Reading