@trackunit/geo-json-utils 1.9.21 → 1.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.esm.js +2 -2
- package/package.json +1 -1
package/index.esm.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import
|
|
2
|
+
import polygonClipping from 'polygon-clipping';
|
|
3
3
|
|
|
4
4
|
// * NOTE: For simplicity these tools are built for 2D coordinate space only!
|
|
5
5
|
/**
|
|
@@ -451,7 +451,7 @@ const isFullyContainedInGeoJsonPolygon = (polygon1, polygon2) => {
|
|
|
451
451
|
* @returns {(GeoJsonMultiPolygon | GeoJsonPolygon)} The intersection as either a Polygon (if one contains the other) or MultiPolygon
|
|
452
452
|
*/
|
|
453
453
|
const getGeoJsonPolygonIntersection = (polygon1, polygon2) => {
|
|
454
|
-
const intersectionResult = intersection(polygon1.type === "MultiPolygon" ? polygon1.coordinates : [polygon1.coordinates], polygon2.type === "MultiPolygon" ? polygon2.coordinates : [polygon2.coordinates]);
|
|
454
|
+
const intersectionResult = polygonClipping.intersection(polygon1.type === "MultiPolygon" ? polygon1.coordinates : [polygon1.coordinates], polygon2.type === "MultiPolygon" ? polygon2.coordinates : [polygon2.coordinates]);
|
|
455
455
|
if (intersectionResult.length === 0) {
|
|
456
456
|
return null;
|
|
457
457
|
}
|