GeoJSON Clip Tool

Clip GeoJSON features to a bounding box or polygon boundary.

Skip to the tool

Clipping is the cookie-cutter operation: you have a global rivers dataset and only need the rivers inside Portugal, or a continent-wide road network and a single city's polygon. Clip drops everything outside the boundary and trims geometries that cross it. It's the same operation as PostGIS's ST_Intersection and QGIS's "Clip" tool.

Paste your data on the left and a clip boundary (Polygon or MultiPolygon) on the right. The tool walks every Feature, keeps it whole if it's entirely inside, drops it if it's entirely outside, and computes the geometric intersection if it crosses the boundary. LineStrings are trimmed at the boundary; Polygons return the inside portion.

Below the widget: how the algorithm handles features that touch the boundary edge, what happens to feature properties (preserved on the clipped piece), and the trade-off between clipping in the browser (this tool, ~50k features comfortably) and pushing it to PostGIS for larger jobs. For the inverse — keeping only what's outside — use a buffer plus difference flow with PostGIS.

Watch out for: features that span multiple disconnected pieces of the clip boundary. A river clipped to a country with multiple islands can produce a single MultiLineString where each part is a different segment of the original — and any per-feature attribute (length, name) now describes the union of disconnected pieces. If downstream code assumes one Feature equals one continuous geometry, expand MultiLineStrings into one Feature per part before passing on. The clip output preserves feature IDs so you can re-aggregate if needed.

What Is Clipping?

Clipping cuts GeoJSON features to the boundary of a specified polygon or bounding box. Any geometry that falls outside the clip boundary is removed, and geometries that cross the boundary are trimmed to fit. The result contains only the portions of features that overlap with the clip region.

How to Use the Clip Tool

Provide the GeoJSON data you want to clip and a clipping polygon. The tool computes the intersection of each feature with the clip boundary and returns a new FeatureCollection containing only the clipped results.

Features entirely inside the clip boundary pass through unchanged. Features entirely outside are removed. Features that cross the boundary are split at the edge.

Common Use Cases

  • Extracting features within a city or county boundary from a larger dataset
  • Trimming a national dataset to a specific region of interest
  • Cropping map data to a viewport or tile boundary
  • Removing offshore data from a coastal dataset

Related spatial operations: turf.intersect() (overlap between two layers), andturf.difference() (subtract one layer from another).

Try It

Clip three NYC landmarks to a Midtown bounding rectangle. Use the landmarks as data input and the polygon below as the clip boundary:

GeoJSON{
  "type": "FeatureCollection",
  "features": [
    {
      "type": "Feature",
      "properties": { "name": "Central Park" },
      "geometry": { "type": "Point", "coordinates": [-73.9654, 40.7829] }
    },
    {
      "type": "Feature",
      "properties": { "name": "Times Square" },
      "geometry": { "type": "Point", "coordinates": [-73.9855, 40.7580] }
    },
    {
      "type": "Feature",
      "properties": { "name": "Brooklyn Bridge" },
      "geometry": { "type": "Point", "coordinates": [-73.9969, 40.7061] }
    }
  ]
}

Clip polygon covering Midtown (40th St to 60th St):

GeoJSON{
  "type": "Feature",
  "properties": { "name": "Midtown Clip" },
  "geometry": {
    "type": "Polygon",
    "coordinates": [[[-74.01, 40.75], [-73.96, 40.75], [-73.96, 40.77], [-74.01, 40.77], [-74.01, 40.75]]]
  }
}

The result contains only Times Square, because it is the only point inside the Midtown clip boundary. Central Park is north of the clip region and Brooklyn Bridge is far south — both are excluded.

How It Works

The clip tool iterates over each feature and computes its geometric intersection with the clip polygon using Turf.js. Point features are tested with a point-in-polygon check. LineString and Polygon features are clipped using the Sutherland-Hodgman algorithm, which computes new vertices at intersection edges. Read about coordinate conventions in the GeoJSON specification guide.