bbox-fns is a lightweight JavaScript library offering a collection of modular utility functions for common geospatial bounding box operations. Bounding boxes are consistently represented as a four-element array: `[xmin, ymin, xmax, ymax]`. Currently at version 0.20.2, the library maintains a relatively frequent release cadence, often introducing new functions or minor fixes, with updates typically occurring every few weeks or months. Its key differentiator lies in its 'super light-weight' design and modular structure, where most functions reside in their own file. This approach facilitates granular imports, allowing developers to include only the specific utilities needed, thereby contributing to smaller bundle sizes. It focuses exclusively on core bounding box manipulations rather than broader GIS features.
npm install bbox-fnsVerified import paths — ran on the pinned version, not inferred.
Demonstrates calculating a bounding box from an array of points, handling NaN values, then calculating its area, and finally checking for intersection with another bounding box.
For `bboxArray` and `reproject` functions, explicitly specify `{ nan_strategy: 'skip' }` in the options to ignore `NaN` values or implement pre-filtering of points to remove `NaN`s if strict error handling is desired.Always use `import` statements with the full path including the `.js` extension (e.g., `import functionName from 'bbox-fns/function-name.js';`). If running in Node.js, ensure your project is configured for ESM (e.g., `"type": "module"` in `package.json` or using `.mjs` files).
Refactor your import statements to use ESM syntax, such as `import functionName from 'bbox-fns/function-name.js';`. Ensure your project's `package.json` correctly sets `"type": "module"` if you intend to use ESM throughout, or use `.mjs` file extensions for ESM files.
Upgrade to `bbox-fns v0.20.0` or higher and provide the `nan_strategy` option: `bboxArray(points, { nan_strategy: 'skip' })` to filter out `NaN` values, or `bboxArray(points, { nan_strategy: 'error' })` to explicitly control the error behavior. Alternatively, pre-filter your input points to remove `NaN` values.No dependency data recorded yet.