@trackunit/geo-json-utils 1.15.18 → 1.15.19
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.cjs.js +9 -0
- package/index.esm.js +9 -0
- package/package.json +1 -1
- package/src/GeoJsonUtils.d.ts +9 -0
package/index.cjs.js
CHANGED
|
@@ -1285,6 +1285,15 @@ const isFullyContainedInGeoJsonPolygon = (polygon1, polygon2) => {
|
|
|
1285
1285
|
/**
|
|
1286
1286
|
* @description Gets the intersection between two GeoJSON polygons/multi-polygons.
|
|
1287
1287
|
* Returns a MultiPolygon representing the intersection, or null if there is no intersection.
|
|
1288
|
+
*
|
|
1289
|
+
* Delegates to `polygon-clipping`, which can **throw** `"Unable to complete output ring"`
|
|
1290
|
+
* for degenerate or near-self-intersecting geometry that is still schema-valid. Callers must
|
|
1291
|
+
* decide how to handle that: `null` here is reserved for a *provably empty* intersection, so
|
|
1292
|
+
* a thrown failure must not be silently folded into `null` (see SAGA-743). Callers for which
|
|
1293
|
+
* "no overlap" is a safe degradation (e.g. overlap grouping in `@trackunit/react-map`) should
|
|
1294
|
+
* catch and treat the throw as no intersection; callers that turn `null` into "no spatial
|
|
1295
|
+
* filter" (e.g. `mapUtils` viewport/area merges) must instead fall back to a conservative
|
|
1296
|
+
* geometry rather than assume disjointness.
|
|
1288
1297
|
*/
|
|
1289
1298
|
const getGeoJsonPolygonIntersection = (polygon1, polygon2) => {
|
|
1290
1299
|
const geom1 = polygon1.type === "MultiPolygon" ? toClipMultiPolygon(polygon1.coordinates) : [toClipPolygon(polygon1.coordinates)];
|
package/index.esm.js
CHANGED
|
@@ -1283,6 +1283,15 @@ const isFullyContainedInGeoJsonPolygon = (polygon1, polygon2) => {
|
|
|
1283
1283
|
/**
|
|
1284
1284
|
* @description Gets the intersection between two GeoJSON polygons/multi-polygons.
|
|
1285
1285
|
* Returns a MultiPolygon representing the intersection, or null if there is no intersection.
|
|
1286
|
+
*
|
|
1287
|
+
* Delegates to `polygon-clipping`, which can **throw** `"Unable to complete output ring"`
|
|
1288
|
+
* for degenerate or near-self-intersecting geometry that is still schema-valid. Callers must
|
|
1289
|
+
* decide how to handle that: `null` here is reserved for a *provably empty* intersection, so
|
|
1290
|
+
* a thrown failure must not be silently folded into `null` (see SAGA-743). Callers for which
|
|
1291
|
+
* "no overlap" is a safe degradation (e.g. overlap grouping in `@trackunit/react-map`) should
|
|
1292
|
+
* catch and treat the throw as no intersection; callers that turn `null` into "no spatial
|
|
1293
|
+
* filter" (e.g. `mapUtils` viewport/area merges) must instead fall back to a conservative
|
|
1294
|
+
* geometry rather than assume disjointness.
|
|
1286
1295
|
*/
|
|
1287
1296
|
const getGeoJsonPolygonIntersection = (polygon1, polygon2) => {
|
|
1288
1297
|
const geom1 = polygon1.type === "MultiPolygon" ? toClipMultiPolygon(polygon1.coordinates) : [toClipPolygon(polygon1.coordinates)];
|
package/package.json
CHANGED
package/src/GeoJsonUtils.d.ts
CHANGED
|
@@ -100,6 +100,15 @@ export declare const isFullyContainedInGeoJsonPolygon: (polygon1: GeoJsonPolygon
|
|
|
100
100
|
/**
|
|
101
101
|
* @description Gets the intersection between two GeoJSON polygons/multi-polygons.
|
|
102
102
|
* Returns a MultiPolygon representing the intersection, or null if there is no intersection.
|
|
103
|
+
*
|
|
104
|
+
* Delegates to `polygon-clipping`, which can **throw** `"Unable to complete output ring"`
|
|
105
|
+
* for degenerate or near-self-intersecting geometry that is still schema-valid. Callers must
|
|
106
|
+
* decide how to handle that: `null` here is reserved for a *provably empty* intersection, so
|
|
107
|
+
* a thrown failure must not be silently folded into `null` (see SAGA-743). Callers for which
|
|
108
|
+
* "no overlap" is a safe degradation (e.g. overlap grouping in `@trackunit/react-map`) should
|
|
109
|
+
* catch and treat the throw as no intersection; callers that turn `null` into "no spatial
|
|
110
|
+
* filter" (e.g. `mapUtils` viewport/area merges) must instead fall back to a conservative
|
|
111
|
+
* geometry rather than assume disjointness.
|
|
103
112
|
*/
|
|
104
113
|
export declare const getGeoJsonPolygonIntersection: (polygon1: GeoJsonPolygon | GeoJsonMultiPolygon, polygon2: GeoJsonPolygon | GeoJsonMultiPolygon) => GeoJsonMultiPolygon | GeoJsonPolygon | null;
|
|
105
114
|
/**
|