What the clip tool does
Clip is one of the most used tools in GIS. You give it two layers. The first one is the input layer: the data you want to cut, for example roads, rivers, bus stops or land parcels. The second one is the clip layer: one or more polygons that describe your area of interest, for example a city boundary or a project site. The tool works like a cookie cutter. It keeps only the parts of the input that fall inside the clip polygons and throws away everything outside.
The output has the same geometry type as the input. Clipped roads are still lines, clipped bus stops are still points, and clipped parcels are still polygons. A road that crosses the boundary is cut exactly where it crosses, and only the inside piece is kept. The attribute table of the input is copied to the output unchanged, so a road keeps its name, its type and every other field. The clip layer only gives its shape. Its own attributes are not added. This is the same rule the Clip tool follows in ArcGIS Pro, in ArcMap and in QGIS.
I built this tool for the many small clip jobs that do not justify opening a desktop GIS. You can drop a zipped Shapefile, GeoJSON, KML, KMZ, GPX or WKT file on the map, or draw your own shapes and clip rectangles. Pick the input and the clip layer, click Clip, and download the result. The whole calculation runs in your browser with open source geometry libraries, so your files never leave your computer. The map starts without a basemap to stay fast and keep the focus on your data. You can switch on a street or satellite basemap at any time.
Supported file formats
You can load several files at once, and you can mix formats. Each file becomes its own layer in the Layers panel. A layer can hold points, lines and polygons at the same time, and every one of them is clipped with the right method.
Input formats (what you can upload)
| Format | Extension | Notes |
|---|---|---|
| GeoJSON | .geojson, .json | A FeatureCollection, a single Feature or a bare geometry. GeometryCollections are split into their parts. |
| Esri Shapefile | .zip | Zip the .shp, .shx and .dbf files together. Add the .prj file and projected data is converted to WGS84 when it loads. A .cpg file sets the text encoding. |
| KML | .kml | Google Earth placemarks. MultiGeometry is split into its parts, and ExtendedData becomes attributes. |
| KMZ | .kmz | A zipped KML file. The first .kml file inside the archive is read. |
| GPX | .gpx | GPS files. Waypoints become points, and tracks and routes become lines. Elevation values are kept. |
| WKT | .wkt, .txt | Well-Known Text. One geometry for the whole file, or one geometry per line. |
Output formats (what you can download)
| Format | Extension | Notes |
|---|---|---|
| GeoJSON | .geojson | The standard web format (RFC 7946) in WGS84. Keeps every attribute. Opens in ArcGIS Pro, QGIS and almost every web map library. |
| KML | .kml | Opens in Google Earth. Attributes are written as ExtendedData on each placemark. |
| CSV (WKT) | .csv | One row per feature. The first column holds the geometry as WKT, and every attribute gets its own column. Opens in Excel, and QGIS can read the WKT column as geometry. |
Each file can be up to 50 MB. For very large national datasets, a desktop GIS is still the better choice. See the comparison further down this page.
Technical details
Here is exactly what the tool does with your data. If you know the Clip tool in ArcGIS Pro or QGIS, most of this will look familiar.
- Input geometry types
- Point, MultiPoint, LineString, MultiLineString, Polygon and MultiPolygon. A single layer can mix all of them.
- Clip geometry types
- Polygon and MultiPolygon, with or without holes. A layer that has no polygons cannot be picked as the clip layer.
- Several clip polygons
- All polygons of the clip layer are merged (dissolved) into one mask before clipping. Where clip polygons overlap, the input is still cut only once, so you get no duplicate features.
- Attributes
- Every attribute of the input feature is copied unchanged. Attributes of the clip layer are not added (use the Polygon Intersection Tool if you need them). As an option, the tool adds
clip_status(inside or clipped),clip_area_m2,clip_length_morclip_points. - Coordinate system
- WGS84 longitude and latitude (EPSG:4326), the same as GeoJSON. A zipped Shapefile with a .prj file is converted to WGS84 when it loads.
- Geometry model
- Cutting is done on a flat plane in degrees, the same model that Turf.js and most web GIS libraries use. Areas and lengths in the results panel are measured on the sphere (geodesic), in square metres and metres.
- Boundary rule
- A point that lies exactly on the clip boundary is kept. A line piece that runs along the boundary is also kept. ArcGIS and QGIS follow the same rule.
- Elevation (Z)
- Existing Z values stay on their vertices. A new vertex created where a line is cut gets a Z value interpolated between its two neighbours.
- Multipart output
- If a feature is cut into several pieces, the pieces stay together as one multipart feature (MultiLineString, MultiPolygon or MultiPoint), as in ArcGIS Pro. Tick "Split multipart results" to get one feature per piece.
- Invalid geometry
- If one input feature has broken geometry (for example a self-crossing polygon), that feature is skipped and counted, and the rest of the layer is still clipped.
- Limits
- 50 MB per file. You can upload several files at once. Speed depends on your device. Tens of thousands of features usually clip in about a second.
- Privacy
- Everything runs in your browser. No file and no geometry is sent to a server.
How to use the clip tool, step by step
Here is the whole workflow with the built-in sample data. Your own files work the same way.

The map opens empty and without a basemap, so nothing loads that you do not need. The toolbar has Point, Line, Polygon and Clip Rectangle drawing tools, an Upload button and a Sample Data button.

Drag and drop your files onto the map, or click Upload. Here I clicked Sample Data: it adds a city layer with parcels, roads and points, and a study area polygon with a lake cut out of it.

In the Clip panel, choose the input layer (the data to cut) and the clip layer (the polygon boundary). Only layers with polygons appear in the clip list. Choose whether you want the extra clip_status, area and length fields, and whether multipart results should be split.

The result appears as a new layer in solid color, and the input layer is hidden. The results box shows how many features went in and came out, how many were fully inside, cut at the boundary or dropped, and the total area, length and point count that was kept.

Tick "Show basemap" to see the result on a street or satellite map. Click any clipped feature to open its attributes. The original fields are all there, plus the optional clip fields.

In the Export panel, pick the layer and download it as GeoJSON, KML or CSV with a WKT column. The small arrow next to each layer in the Layers panel is a quick GeoJSON download.
How to clip a polygon (and lines and points)
The idea is the same in every GIS program: one layer is cut, another layer does the cutting. Here is how to clip a polygon layer in this tool, in ArcGIS Pro, in ArcMap and in QGIS, and how to do it in a script with arcpy.
In this tool
Load the polygons you want to cut and the boundary polygon. Choose the polygons as the input layer and the boundary as the clip layer, then click Clip Layer. If you only need a rectangular area, click Clip Rectangle and click two opposite corners on the map. The rectangle becomes the clip layer at once. Lines and points in the same input layer are clipped in the same run.
In ArcGIS Pro
Open the Geoprocessing pane and search for Clip, or go to Analysis toolbox > Extract toolset > Clip. Set Input Features to the layer you want to cut and Clip Features to your boundary, choose an output feature class and click Run. ArcGIS Pro also has Pairwise Clip in the Pairwise Overlay toolset, which does the same job with parallel processing and is faster on big data. Both keep only the attributes of the input features.
In ArcMap
In ArcMap the tool is in ArcToolbox > Analysis Tools > Extract > Clip, and also in the Geoprocessing menu. The parameters are the same as in ArcGIS Pro. Esri retired ArcMap in March 2026, so for new work I recommend ArcGIS Pro, QGIS or this tool. Old ArcMap models and scripts that call Clip_analysis usually move to ArcGIS Pro with small changes.
In QGIS
Go to Vector > Geoprocessing Tools > Clip. Choose the Input layer and the Overlay layer (the polygon boundary), then click Run. The result is added as a temporary layer, which you can save as a GeoPackage or Shapefile. If you only need a rectangle, open the Processing Toolbox, run Extract/Clip by Extent from the Vector overlay group, and tick "Clip features to extent".
With arcpy (Python for ArcGIS)
In ArcGIS Pro the function is arcpy.analysis.Clip(in_features, clip_features, out_feature_class). Old ArcMap scripts use the older name arcpy.Clip_analysis, which still works. An optional fourth parameter sets the cluster (XY) tolerance. The code below shows both forms, plus the same job in PyQGIS, GDAL and GeoPandas.
The same clip in code
If you clip the same kind of data every week, a script saves time. These examples all cut a roads layer to a study area polygon.
import arcpy
arcpy.env.workspace = r"C:\data\city.gdb"
# ArcGIS Pro: Analysis toolbox > Extract > Clip
arcpy.analysis.Clip("roads", "study_area", "roads_clip")
# Older ArcMap syntax (same tool, old name)
arcpy.Clip_analysis("roads", "study_area", "roads_clip")# QGIS Python console: Vector > Geoprocessing Tools > Clip
processing.run("native:clip", {
"INPUT": "C:/data/roads.shp",
"OVERLAY": "C:/data/study_area.shp",
"OUTPUT": "C:/data/roads_clip.gpkg",
})# GDAL / OGR command line
ogr2ogr -clipsrc study_area.shp roads_clip.gpkg roads.shp
# GeoPandas
import geopandas as gpd
roads = gpd.read_file("roads.shp")
area = gpd.read_file("study_area.shp")
roads_clip = gpd.clip(roads, area)My take: for one clip on a normal sized file, this tool is the fastest way from file to result. For clips that repeat or run inside a bigger workflow, write an arcpy or PyQGIS script once and reuse it.
How the tool works, step by step
This is the path your data takes from the moment you click Clip Layer. Every step runs in your browser.
- Read and clean the input. Every file is turned into GeoJSON features in WGS84. A GeometryCollection is split into separate features that share the same attributes, so the clipper only ever sees simple geometry types.
- Dissolve the clip layer. All polygons of the clip layer are merged into one geometry, the mask
M, with a polygon union. Holes stay holes. Because overlapping clip polygons become one shape, a road inside two overlapping clip polygons is still kept only once. - Quick bounding box test. The tool compares the bounding box of each input feature with the bounding box of
M. If the two boxes do not touch, the feature cannot be inside, so it is dropped at once without any detailed math. On large layers this skips most of the work. - Clip points. Each point is tested with a point-in-polygon test against
M. Points inside or on the boundary are kept. For a MultiPoint, only the inside points stay. - Clip lines. Each line segment is tested against every edge of
Mthat is near it. The tool finds every place where the segment crosses an edge and cuts it there. Then it looks at the middle of each small piece: if the middle is insideM, the piece is kept. Pieces that touch each other are joined again into one line. - Clip polygons. Each polygon is intersected with
Mby a sweep-line boolean algorithm (Martinez-Rueda). This returns the exact shared area, including new holes whereMhas holes. - Copy attributes and add fields. Each output feature gets a copy of all attributes from its input feature. If you asked for it, the tool adds
clip_statusand the kept area, length or point count. If you ticked the multipart option, multipart results are split into single parts here. - Report and draw. The tool counts features that were fully inside, cut at the boundary, dropped or skipped, sums the kept area and length, and adds the result as a new layer on the map. The input layer is hidden so you can see the result clearly.
The steps are split this way because each geometry type needs different math. Points only need an inside/outside test. Lines need crossing points. Polygons need a full boolean overlay. Using the cheapest correct method for each type keeps the tool fast.
The theory and math behind clipping
Clipping looks simple on a map, but it rests on a few classic results from computational geometry. Here they are, in the order the tool uses them.
1. Clip as a set operation
In set theory, clipping is an intersection. Each input feature a is replaced by the part it shares with the mask M. Features that share nothing with M disappear. The mask is the union of all clip polygons.
Clip(A, M) = { a ∩ M : a ∈ A and a ∩ M ≠ ∅ }
M = M₁ ∪ M₂ ∪ … ∪ Mₖ (all clip polygons, merged first)The difference from a full Intersect is only in what happens to the attributes: Clip keeps the attributes of a and ignores those of M. The geometry of the result is the same.
2. Point in polygon: the ray casting rule
To decide if a point is inside a polygon, draw a ray from the point to the right and count how many times it crosses the polygon boundary. An odd count means inside, an even count means outside. Holes need no special case: they are just more edges to count.
Point P = (x, y). Edge from (xi, yi) to (xj, yj). The edge is crossed when: (yi > y) ≠ (yj > y) and x < xi + (y − yi) · (xj − xi) / (yj − yi) P is inside ⇔ the number of crossed edges is odd
The library used here (point-in-polygon-hao) implements a refined version of this test by Hao and colleagues (2018). It also finds points that sit exactly on an edge, so the tool can keep boundary points on purpose.
3. Where a line crosses the boundary
A line segment from p to q and a boundary edge from a to b are both written in parametric form. Solving the two equations with 2D cross products gives the crossing point directly.
Segment: P(t) = p + t · r, r = q − p, 0 ≤ t ≤ 1 Edge: E(u) = a + u · s, s = b − a, 0 ≤ u ≤ 1 cross(v, w) = v.x · w.y − v.y · w.x w = a − p t = cross(w, s) / cross(r, s) u = cross(w, r) / cross(r, s) Real crossing ⇔ 0 < t < 1 and 0 ≤ u ≤ 1 cross(r, s) = 0 ⇔ segment and edge are parallel
When the segment and the edge are parallel, there is no single crossing point. The tool does not need one: it cuts at all other crossings and then tests the middle of every piece with the point-in-polygon rule. A piece that runs exactly along the boundary has its middle on the boundary, so it is kept.
4. A worked example
Take a road from (−5, 5) to (15, 5), and a square clip polygon from 0 to 10 in both directions, with a square hole (a lake) from 4 to 6. The road crosses four edges, at t = 0.25, 0.45, 0.55 and 0.75.
Road: p = (−5, 5) q = (15, 5) r = (20, 0) Piece (t) Middle x Test Kept 0.00 – 0.25 −2.5 outside no 0.25 – 0.45 2.0 inside yes → (0, 5) – (4, 5) 0.45 – 0.55 5.0 in the hole no 0.55 – 0.75 8.0 inside yes → (6, 5) – (10, 5) 0.75 – 1.00 12.5 outside no Result: MultiLineString [ (0,5)–(4,5) , (6,5)–(10,5) ]
The road is 20 units long. It loses 5 units on each side of the square and 2 more across the lake, so 8 units are kept, in two pieces of 4 units each. This is the exact case the tool's own tests check.
5. Polygon clipping: from Sutherland-Hodgman to sweep lines
Polygon clipping is an old problem in computer graphics. Sutherland and Hodgman published the first widely used method in 1974. It clips a polygon against a convex window one edge at a time. Weiler and Atherton (1977) could handle concave shapes and holes by walking along both boundaries. Later came Vatti (1992) and Greiner-Hormann (1998). GIS needs the general case: any shape, with holes, many parts and touching edges.
This tool uses polyclip-ts through Turf.js. It is based on the sweep-line algorithm of Martínez, Rueda and Feito (2009). An imaginary vertical line moves from left to right across both polygons. It stops only at vertices and crossing points, and at each stop it decides which edges belong to the result. For n edges with k crossings, the cost is about O((n + k) · log n). The library does its key comparisons with arbitrary-precision numbers (bignumber.js), so rounding errors do not break edge cases such as touching or nearly parallel edges.
6. Measuring what was kept
The results panel reports areas and lengths on the Earth's surface, not in degrees. Areas use the spherical ring formula from Chamberlain and Duquette (NASA JPL, 2007), which Turf.js uses. Lengths use the haversine formula. Both use the mean Earth radius R = 6,371,008.8 m.
Ring area (λ = longitude, φ = latitude, in radians): A = (R² / 2) · | Σ (λ(i+1) − λ(i−1)) · sin φi | Segment length (haversine): h = sin²(Δφ / 2) + cos φ1 · cos φ2 · sin²(Δλ / 2) d = 2R · asin(√h) R = 6 371 008.8 m
A sphere is a close model of the Earth. For areas and lengths, the error is usually less than 1 percent. That is fine for checking results and for reports, but if you need survey-grade figures, calculate them in a local projected coordinate system.
7. A note on flat versus curved edges
The cutting itself is done on a flat plane in longitude and latitude, the same way Turf.js, GeoPandas in EPSG:4326 and most web tools work. Each edge is a straight line in degrees. For city, county or project-sized data the difference from a true great-circle edge is far below the accuracy of the data. For edges hundreds of kilometres long, the straight-in-degrees line and the great-circle line can move apart by a noticeable amount. In that case, add more vertices to long edges before clipping, or use a desktop GIS in a projected coordinate system.
Best clip tool in GIS: this tool, ArcGIS Pro and QGIS compared
People often ask me which is the best clip tool in GIS. The honest answer is that it depends on the job. Here is a side-by-side view.
| Feature | This tool | ArcGIS Pro | QGIS |
|---|---|---|---|
| Price | Free, no account | Paid ArcGIS licence | Free and open source |
| Installation | None, runs in the browser | Windows desktop app | Desktop app for Windows, macOS and Linux |
| Input formats | GeoJSON, Shapefile ZIP, KML, KMZ, GPX, WKT | Geodatabases, shapefiles and many more | Everything GDAL/OGR can read |
| Clips points, lines and polygons | Yes, even mixed in one layer | Yes | Yes |
| Attributes in output | Input attributes, plus optional clip fields | Input attributes | Input attributes |
| Coordinate systems | WGS84 (Shapefile .prj is converted on load) | Any, with XY tolerance and environment settings | Any, with on-the-fly reprojection |
| Automation | None, one run at a time | arcpy and ModelBuilder | PyQGIS and the Graphical Modeler |
| Very large datasets | Up to 50 MB per file | Yes, with Pairwise Clip | Yes |
| Where your data goes | Stays in your browser | Stays on your computer | Stays on your computer |
My recommendation: if you already have ArcGIS Pro and your data lives in a geodatabase, use Clip or Pairwise Clip there. The results integrate with the rest of your project, and arcpy lets you repeat the job. If you want a full desktop GIS at no cost, QGIS has an excellent Clip tool and reads almost any format.
This tool wins when speed from file to result matters more than anything else: a colleague sends you a KML or a zipped Shapefile, you need only the part inside a site boundary, and you do not want to install or open anything. It is also handy on a computer where you cannot install software, and it is a clear way to learn what Clip does, because you can see every step on the map.
10 real-world use cases
Clip is used in almost every field that works with maps. These are the jobs I see most often.
- Roads inside a city boundary. A transport planner has a national road network but needs only the roads inside one city. Clipping the network to the city boundary gives the exact road length inside the city, ready for a report or a traffic model.
- Environmental impact assessment. Consultants clip habitat maps, protected areas and wetlands to a project footprint or its buffer. The result shows which habitats the project touches and how many hectares of each would be affected.
- Farm and field planning. A farmer or agronomist clips a regional soil map to the field boundaries. Each field then has its own soil polygons with their original soil attributes, which is the base for variable-rate fertiliser or seeding plans.
- Utility networks per service area. Water, power and telecom companies clip pipe, cable or fibre lines to a maintenance district or service area. Each team gets only its own part of the network, and the clipped length helps with planning and budgets.
- Parcels and zoning for a development site. Urban planners and real estate analysts clip parcel and zoning layers to a planned development area. The attributes, such as owner, land use and zoning code, stay with each clipped parcel.
- Emergency planning in flood zones. Emergency managers clip buildings, schools, hospitals and roads to a flood zone or evacuation zone. The output is the list of assets at risk, with their attributes, which can go straight into a response plan.
- GPS tracks inside a park. Park rangers and hikers clip GPX tracks to a national park or nature reserve boundary. This shows how many kilometres of a route really run inside the park, with elevation values kept on every point.
- Forestry and harvest blocks. Foresters clip forest stand polygons to a harvest block or an administrative unit. The clipped stands keep their species, age and volume attributes, and the clipped area feeds straight into the harvest calculation.
- Smaller files for web maps. Web developers often start from a large national GeoJSON or Shapefile. Clipping it to the region the map shows can cut the file size a lot, which makes the web map load much faster.
- Research and teaching. Researchers clip survey points, sample sites or trajectories to their study area before running statistics. Teachers use the tool in GIS classes because students can see clip work on the map without installing any software.
Frequently asked questions
Twenty questions people ask about clipping in GIS, with direct answers.
1. What does the Clip tool do in GIS?
Clip cuts an input layer to the shape of a clip layer. It keeps only the parts of the input features that fall inside the clip polygons, and it keeps the attributes of the input features. You can think of it as a cookie cutter: the clip polygon is the cutter, and the input layer is the dough.
2. How do I clip a polygon with another polygon?
Load both layers, choose the polygon layer you want to cut as the input layer and the boundary polygon as the clip layer, then click Clip Layer. In ArcGIS Pro use Analysis > Extract > Clip, and in QGIS use Vector > Geoprocessing Tools > Clip. In every case the input polygons are cut along the edge of the clip polygon, and only the inside part is kept.
3. What is the difference between Clip and Intersect?
Both return the same geometry for the overlapping area. The difference is the attributes. Clip keeps only the attributes of the input layer. Intersect combines the attributes of both layers, so each output feature carries fields from both. Use Clip when the boundary is just a cutter, and Intersect when you also need to know which zone each piece fell in.
4. What is the difference between Clip and Erase?
They are opposites. Clip keeps what is inside the clip polygons. Erase (called Difference in QGIS) keeps what is outside them. If you run both on the same data, the two outputs together give back the original input.
5. Can I clip lines and points, or only polygons?
You can clip all three. Points inside the clip polygons are kept, lines are cut at the boundary so only the inside pieces remain, and polygons are cut to the shared area. One input layer can even mix points, lines and polygons, and each is handled with the right method in the same run.
6. Which attributes does the clipped layer keep?
Every attribute of the input feature is copied to its clipped version without changes. The attributes of the clip layer are not added. As an option, the tool adds clip_status (inside or clipped) and the kept area in square metres, length in metres or number of points.
7. Can the clip layer have several polygons or polygons with holes?
Yes. All polygons in the clip layer are merged into one mask first, so overlapping clip polygons never create duplicate output. Holes are respected: anything inside a hole, such as a lake cut out of a study area, is removed from the result.
8. Which file formats can I upload?
GeoJSON (.geojson or .json), a zipped Esri Shapefile (.zip with .shp, .shx and .dbf, plus .prj if the data is projected), KML, KMZ, GPX and WKT (.wkt or .txt). You can upload several files at once and mix formats.
9. Which formats can I download?
GeoJSON, KML and CSV. The CSV has the geometry as WKT in the first column and one column per attribute. GeoJSON is the best choice if you want to open the result in ArcGIS Pro or QGIS, because it keeps the attribute types.
10. Is my data uploaded to a server?
No. Reading the files, clipping and writing the output all run in your browser. Your files never leave your computer. Only the optional basemap tiles are loaded from the internet, and only after you turn the basemap on.
11. What coordinate system does the tool use? Can I clip projected data?
The tool works in WGS84 longitude and latitude (EPSG:4326). A zipped Shapefile in a projected system such as UTM or a national grid is converted to WGS84 when it loads, as long as the .prj file is inside the ZIP. GeoJSON should already be in WGS84, as the GeoJSON standard requires.
12. Why are some features missing from the output?
Features that lie completely outside the clip polygons are removed. That is the purpose of Clip. The results box shows how many were dropped. If a feature you expected is missing, check that both layers are in the right place on the map. A Shapefile without its .prj file often ends up in the wrong location.
13. What happens to features exactly on the clip boundary?
A point that lies exactly on the boundary is kept, and so is a line piece that runs along the boundary. A polygon that only touches the boundary from outside shares no area with the clip polygon, so it is removed. ArcGIS and QGIS follow the same rules.
14. How big a file can I clip?
Up to 50 MB per file. Tens of thousands of features usually clip in about a second on a normal laptop. For very large data, such as all buildings in a country, a desktop GIS like ArcGIS Pro with Pairwise Clip, or QGIS, is the better tool.
15. How do I clip to a rectangle or bounding box?
Click Clip Rectangle in the toolbar, then click two opposite corners on the map. The rectangle is added as a new layer and chosen as the clip layer at once. You can also upload a polygon from the Bounding Box Tool on this site if you need exact coordinates.
16. Why did my line or polygon turn into a Multi geometry?
When the clip boundary cuts a feature into more than one piece, the pieces stay together as one multipart feature (MultiLineString or MultiPolygon), so the attributes are not duplicated. ArcGIS Pro does the same. Tick "Split multipart results into single parts" if you want one feature per piece.
17. How do I clip in ArcGIS Pro?
Open the Geoprocessing pane, search for Clip and open Clip (Analysis tools). Set Input Features and Clip Features, choose the output and click Run. For big data, Pairwise Clip in the Pairwise Overlay toolset does the same job faster with parallel processing.
18. How do I clip in QGIS?
Go to Vector > Geoprocessing Tools > Clip, choose the Input layer and the Overlay layer, and click Run. In the Python console, the same job is processing.run("native:clip", ...) with the INPUT, OVERLAY and OUTPUT parameters. For a rectangle, use Extract/Clip by Extent from the Processing Toolbox.
19. How do I clip with arcpy in a Python script?
In ArcGIS Pro, call arcpy.analysis.Clip("roads", "study_area", "roads_clip"). The older ArcMap form arcpy.Clip_analysis(...) takes the same parameters. You can loop over many layers or many boundaries with a simple for loop, which is where arcpy saves the most time.
20. Are the area and length numbers in the results accurate?
They are measured on a sphere with a radius of 6,371,008.8 m, so they are in real square metres and metres, not degrees. The error against the true ellipsoid is usually less than 1 percent. That is fine for planning and reports. For legal or survey-grade values, measure again in a local projected coordinate system.
Libraries used and credits
This tool is built on open source software. Many thanks to the people who wrote and maintain these projects.
- Leaflet 1.9 · BSD-2-Clause · Volodymyr Agafonkin and contributorsDraws the interactive map, the layers, the drawing tools and the popups.
- Turf.js 7 (@turf/intersect, @turf/union, @turf/area, @turf/boolean-point-in-polygon) · MIT · Turf authorsPolygon intersection for clipping polygons, union for dissolving the clip layer, geodesic area, and the point-in-polygon test.
- polyclip-ts · MIT · Luiz Felipe Machado Barboza, based on polygon-clipping by Mike FogelThe boolean polygon engine behind Turf's intersect and union. It uses the Martinez-Rueda sweep-line algorithm with arbitrary-precision math.
- point-in-polygon-hao · MIT · Rowan WinsemiusThe fast point-in-polygon test that decides which points and line pieces are inside the clip area.
- shpjs · MIT · Calvin MetcalfReads zipped Esri Shapefiles (.shp, .shx, .dbf, .prj, .cpg) in the browser.
- proj4js · MIT · proj4js contributorsConverts projected Shapefiles to WGS84 using their .prj file (used by shpjs).
- @tmcw/togeojson · BSD-2-Clause · Tom MacWrightConverts KML and GPX files to GeoJSON.
- JSZip · MIT or GPL-3.0 · Stuart KnightleyOpens KMZ archives to read the KML file inside.
- @terraformer/wkt · MIT · Terraformer contributorsReads WKT input and writes the WKT geometry column in the CSV export.
- OpenStreetMap, Protomaps (hosted by KONAKTIVE), CARTO, Esri World Imagery · ODbL / provider terms · OpenStreetMap contributors, Protomaps, KONAKTIVE, CARTO, EsriBasemap tiles and imagery, shown only when you turn the basemap on.
The line clipping step (splitting segments at boundary crossings and testing each piece) was written for this tool. The clip engine is checked by automated tests that cover lines through holes, lines along the boundary, points on the edge, polygons over holes, overlapping clip polygons and Z interpolation.
Related geoprocessing tools
All clipping runs in your browser. No file is ever uploaded to a server. Map tiles © OpenStreetMap contributors, Protomaps (hosted by KONAKTIVE), CARTO, Esri.
