Learn

GeoJSON MultiPolygon

A GeoJSON MultiPolygon represents a single geographic feature that consists of multiple disconnected polygons. The canonical example is a country with islands.

When to use MultiPolygon

Use MultiPolygon when a single real-world entity consists of disconnected areas. Three concrete cases where this applies:

  • France includes Réunion — an island in the Indian Ocean that is politically France but geographically separate from mainland Europe.
  • Alaska is part of the USA, separated from the contiguous states by Canada.
  • An administrative district can be split by a river or highway into two disconnected zones that are managed as one unit.

The deciding question is whether the areas represent one entity or several. If you have five separate parks in a city, each park is its own Polygon Feature. If those five parcels together form a single protected zone with one name and one administrative body, that is a MultiPolygon.

Coordinate structure

MultiPolygon adds one level of nesting on top of Polygon. The four levels, from innermost to outermost:

  1. Position — [longitude, latitude], e.g. [-157.9, 21.3]
  2. Ring — array of positions that closes back on itself (first position = last position)
  3. Polygon — array of rings (outer ring + any holes)
  4. MultiPolygon — array of polygons
{
  "type": "Feature",
  "properties": { "name": "Hawaii (simplified)", "iso_a2": "US" },
  "geometry": {
    "type": "MultiPolygon",
    "coordinates": [
      [
        [
          [-157.9, 21.3], [-157.6, 21.3], [-157.6, 21.5],
          [-157.9, 21.5], [-157.9, 21.3]
        ]
      ],
      [
        [
          [-156.6, 20.5], [-156.3, 20.5], [-156.3, 20.9],
          [-156.6, 20.9], [-156.6, 20.5]
        ]
      ]
    ]
  }
}

Reading from the coordinates value outward: the outermost array is the array of polygons — each element is one island. Each polygon is an array of rings — here each island has a single outer ring with no holes. Each ring is an array of positions in [longitude, latitude] order.

The two polygons above represent two Hawaiian islands. Both belong to the same Feature; they share the same properties object.

Build a MultiPolygon from separate Polygons

When you have a FeatureCollection of Polygon Features that should be merged into one MultiPolygon Feature — for example after a database query returns one row per part — this function assembles them:

function toMultiPolygon(polygonFeatures) {
  return {
    type: 'Feature',
    properties: polygonFeatures[0].properties,
    geometry: {
      type: 'MultiPolygon',
      coordinates: polygonFeatures.map(f => f.geometry.coordinates),
    },
  }
}

Each f.geometry.coordinates is already [rings] — an array of rings. map wraps each one into the outer array, producing [[rings], [rings], ...], which is the correct MultiPolygon coordinate shape.

Note: this takes properties from the first feature. If the parts carry different property values, decide which wins before calling this function.

Difference from GeometryCollection

Both types group geometries together, but they serve different purposes:

  • MultiPolygon — all parts are the same type (Polygon), and all parts represent one entity. A country with islands is a MultiPolygon, not a collection of separate country Features.
  • GeometryCollection — parts can be different types (a Point and a Polygon in the same object). Used when a single entity is genuinely multi-typed — for example, a named place represented as both its centroid (Point) and its administrative boundary (Polygon).

For country and district boundaries, MultiPolygon is almost always the right choice. GeometryCollection is rare in practice; most GIS tools generate it only when a single entity has geometrically incompatible parts.

Watch out: MultiPolygon has one more level of nesting than Polygon. A Polygon's coordinates is [rings]. A MultiPolygon's coordinates is [[rings], [rings], ...]. The most common error is building [[positions]] instead of [[[positions]]].

For the full polygon reference including winding order and holes, see GeoJSON polygon. For a geometry type overview, see GeoJSON geometry types.

Element Editor renders and edits MultiPolygon features with the same tools as single polygons — open source under MIT.

Continue reading

Mike Acler

Mike Acler

Design engineer and creator of Element Editor, an open-source map drawing and GeoJSON editing library for React. Writes about web cartography and GIS tooling.