Security News
The Risks of Misguided Research in Supply Chain Security
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.
closest-feature
Advanced tools
find the closest geojson feature (or the one the point is inside) from a point
Measure distances
NPM
npm install --save closest-feature
YARN
yarn add closest-feature
// ES6
import closest from 'closest-feature';
// older
const closest = require('closest-feature').default;
let features = [
{ "type": "Feature", "properties": { "COUNTYNBR": "18", "NAME": "Herriman", "COUNTYSEAT": 0, "SHORTDESC": "HERRIMAN TOWN", "UPDATED": "2016\/09\/02", "FIPS": "34970", "ENTITYNBR": 3035, "SALESTAXID": "060", "IMSCOLOR": 1, "MINNAME": null, "POPLASTCEN": 22018, "POPLASTEST": 30835, "GNIS": "1428675", "Shape_Leng": 57216.656373500002, "Shape_Area": 55755135.693899997 }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -111.999923241180639, 40.536929968126046 ],
...
[ -111.999923241180639, 40.536929968126046 ] ] ] } },
{ "type": "Feature", "properties": { "COUNTYNBR": "18", "NAME": "Riverton", "COUNTYSEAT": 0, "SHORTDESC": "RIVERTON", "UPDATED": "2016\/09\/02", "FIPS": "64340", "ENTITYNBR": 3060, "SALESTAXID": "118", "IMSCOLOR": 2, "MINNAME": null, "POPLASTCEN": 39330, "POPLASTEST": 41900, "GNIS": "1431862", "Shape_Leng": 34602.250230700003, "Shape_Area": 32683657.6131 }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -111.999080957488104, 40.523382315465085 ],
...
[ -111.999080957488104, 40.523382315465085 ] ] ] } }
];
let props = closest([-112.09698739755993, 40.49797074565671], features);
console.log(props === features[0].properties) // true
Copyright 2017 Copyright (c) 2004-2010 by Internet Systems Consortium, Inc. ("ISC") Copyright (c) 1995-2003 by Internet Software Consortium
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
FAQs
find the closest geojson feature (or the one the point is inside) from a point
We found that closest-feature demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.
Research
Security News
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.