blistradius
v3.0.0
Published
Lightweight geospatial radius utilities — distance, proximity checks, and circular bounding helpers for Node.js and the browser.
Maintainers
Readme
blistradius
Lightweight geospatial radius utilities for Node.js and the browser — great-circle distance, proximity checks, and circular bounding boxes.
Install
npm install blistradiusUsage
const {
distance,
isWithinRadius,
boundingBox,
filterWithinRadius,
} = require('blistradius');
const sf = { lat: 37.7749, lon: -122.4194 };
const la = { lat: 34.0522, lon: -118.2437 };
// Haversine distance in kilometers (default) or meters
distance(sf, la); // ~559
distance(sf, la, { unit: 'm' });
// Proximity check
isWithinRadius(sf, la, 600); // true
// Coarse geographic filter box for a 25 km radius
boundingBox(sf, 25);
// Keep only points inside the circle
filterWithinRadius(sf, [la, { lat: 37.78, lon: -122.41 }], 10);API
| Function | Description |
| --- | --- |
| distance(a, b, options?) | Great-circle distance (unit: 'km' | 'm') |
| isWithinRadius(center, target, radius, options?) | Whether target is inside the circle |
| boundingBox(center, radiusKm) | Approximate lat/lon bounding box |
| filterWithinRadius(center, points, radius, options?) | Filter an array of points |
| toRadians(degrees) / toDegrees(radians) | Angle helpers |
License
MIT
