Description
Apply boolean Polygon clipping operations (intersection, union, difference, xor) to your Polygons & MultiPolygons.
polygonclipping alternatives and similar libraries
Based on the "Maps" category.
Alternatively, view polygonclipping alternatives based on common mentions on social networks and blogs.

Leaflet
π JavaScript library for mobilefriendly interactive maps πΊπ¦ 
Cesium
An opensource JavaScript library for worldclass 3D globes and maps :earth_americas: 
geojson.io
A quick, simple tool for creating, viewing, and sharing spatial data 
kartograph.js
UNMAINTAINED Open source JavaScript renderer for Kartograph SVG maps 
polymaps
Polymaps is a free JavaScript library for making dynamic, interactive maps in modern web browsers. 
vue3openlayers
Web map Vue 3.x components with the power of OpenLayers 
@terraformer
A geographic toolkit for dealing with geometry, geography, formats, and building geodatabases 
tle.js
π°οΈ Satellite TLE tools in JavaScript: get lat/lon of satellites, get look angles, plot orbit lines, extract individual TLE elements, etc
Appwrite  The opensource backend cloud platform
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of polygonclipping or a related project?
README
polygonclipping
Apply boolean Polygon clipping operations (intersection
, union
, difference
, xor
) to your Polygons & MultiPolygons.
Quickstart
<! prettierignorestart >
const polygonClipping = require('polygonclipping')
const poly1 = [[[0,0],[2,0],[0,2],[0,0]]]
const poly2 = [[[1,0],[1,0],[0,1],[1,0]]]
polygonClipping.union (poly1, poly2 /* , poly3, ... */)
polygonClipping.intersection(poly1, poly2 /* , poly3, ... */)
polygonClipping.xor (poly1, poly2 /* , poly3, ... */)
polygonClipping.difference (poly1, poly2 /* , poly3, ... */)
<! prettierignoreend >
API
/* All functions take one or more [multi]polygon(s) as input */
polygonClipping.union (<geom>, ...<geoms>)
polygonClipping.intersection(<geom>, ...<geoms>)
polygonClipping.xor (<geom>, ...<geoms>)
/* The clipGeoms will be subtracted from the subjectGeom */
polygonClipping.difference(<subjectGeom>, ...<clipGeoms>)
Input
Each positional argument (<geom>
) may be either a Polygon or a MultiPolygon. The GeoJSON spec is followed, with the following notes/modifications:
 MultiPolygons may contain touching or overlapping Polygons.
 rings are not required to be selfclosing.
 rings may contain repeated points, which are ignored.
 rings may be selftouching and/or selfcrossing. Selfcrossing rings will be interpreted using the nonzero rule.
 winding order of rings does not matter.
 inner rings may extend outside their outer ring. The portion of inner rings outside their outer ring is dropped.
 inner rings may touch or overlap each other.
Output
For nonempty results, output will always be a MultiPolygon containing one or more nonoverlapping, nonedgesharing Polygons. The GeoJSON spec is followed, with the following notes/modifications:
 outer rings will be wound counterclockwise, and inner rings clockwise.
 inner rings will not extend outside their outer ring.
 rings will not overlap, nor share an edge with each other.
 rings will be selfclosing.
 rings will not contain repeated points.
 rings will not contain superfluous points (intermediate points along a straight line).
 rings will not be selftouching nor selfcrossing.
 rings may touch each other, but may not cross each other.
In the event that the result of the operation is the empty set, output will be a MultiPolygon with no Polygons: []
.
Correctness
Run: npm test
The tests are broken up into unit tests and endtoend tests. The endtoend tests are organized as GeoJSON files, to make them easy to visualize thanks to GitHub's helpful rendering of GeoJSON files. Browse those tests [here](test/endtoend).
Performance
The MartinezRuedaFeito polygon clipping algorithm is used to compute the result in O((n+k)*log(n))
time, where n
is the total number of edges in all polygons involved and k
is the number of intersections between edges.
Settings
Global settings are set via environment variables.
 POLYGON_CLIPPING_MAX_QUEUE_SIZE and POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS: Aims to prevent infinite loops  usually caused by floatingpoint math roundoff errors. Defaults are 1,000,000.
Changelog
This project adheres to Semantic Versioning.
<! prettierignoreend >
The full changelog is available at CHANGELOG.md.
Authors
Sponsors
Please contact Mike Fogel if you or your company is interested in sponsoring work on specific bug fixes or feature requests.
Based on
 [A new algorithm for computing Boolean operations on polygons](paper.pdf) by Francisco Martinez, Antonio Jesus Rueda, Francisco Ramon Feito (2009)
*Note that all licence references and agreements mentioned in the polygonclipping README section above
are relevant to that project's source code only.