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: intersection (overlap between two layers), 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.