all these changes

This commit is contained in:
Jake Kasper
2026-04-09 13:19:47 -05:00
parent e83a51a051
commit 65315f36d1
39102 changed files with 7932979 additions and 567 deletions

20
frontend/node_modules/@turf/clusters-kmeans/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,20 @@
The MIT License (MIT)
Copyright (c) 2017 TurfJS
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

69
frontend/node_modules/@turf/clusters-kmeans/README.md generated vendored Normal file
View File

@@ -0,0 +1,69 @@
# @turf/clusters-kmeans
<!-- Generated by documentation.js. Update this documentation by updating the source code. -->
## clustersKmeans
Takes a set of [points][1] and partition them into clusters using the k-mean .
It uses the [k-means algorithm][2]
**Parameters**
- `points` **[FeatureCollection][3]&lt;[Point][4]>** to be clustered
- `options` **[Object][5]** Optional parameters (optional, default `{}`)
- `options.numberOfClusters` **[number][6]** numberOfClusters that will be generated (optional, default `Math.sqrt(numberOfPoints/2)`)
- `options.mutate` **[boolean][7]** allows GeoJSON input to be mutated (significant performance increase if true) (optional, default `false`)
**Examples**
```javascript
// create random points with random z-values in their properties
var points = turf.randomPoint(100, {bbox: [0, 30, 20, 50]});
var options = {numberOfClusters: 7};
var clustered = turf.clustersKmeans(points, options);
//addToMap
var addToMap = [clustered];
```
Returns **[FeatureCollection][3]&lt;[Point][4]>** Clustered Points with an additional two properties associated to each Feature:- {number} cluster - the associated clusterId
- {[number, number]} centroid - Centroid of the cluster [Longitude, Latitude]
[1]: https://tools.ietf.org/html/rfc7946#section-3.1.2
[2]: https://en.wikipedia.org/wiki/K-means_clustering
[3]: https://tools.ietf.org/html/rfc7946#section-3.3
[4]: https://tools.ietf.org/html/rfc7946#section-3.1.2
[5]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object
[6]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number
[7]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean
<!-- This file is automatically generated. Please don't edit it directly:
if you find an error, edit the source file (likely index.js), and re-run
./scripts/generate-readmes in the turf project. -->
---
This module is part of the [Turfjs project](http://turfjs.org/), an open source
module collection dedicated to geographic algorithms. It is maintained in the
[Turfjs/turf](https://github.com/Turfjs/turf) repository, where you can create
PRs and issues.
### Installation
Install this module individually:
```sh
$ npm install @turf/clusters-kmeans
```
Or install the Turf module that includes it as a function:
```sh
$ npm install @turf/turf
```

57
frontend/node_modules/@turf/clusters-kmeans/dist/es/index.js generated vendored Executable file
View File

@@ -0,0 +1,57 @@
import clone from "@turf/clone";
import { coordAll, featureEach } from "@turf/meta";
import skmeans from "skmeans";
/**
* Takes a set of {@link Point|points} and partition them into clusters using the k-mean .
* It uses the [k-means algorithm](https://en.wikipedia.org/wiki/K-means_clustering)
*
* @name clustersKmeans
* @param {FeatureCollection<Point>} points to be clustered
* @param {Object} [options={}] Optional parameters
* @param {number} [options.numberOfClusters=Math.sqrt(numberOfPoints/2)] numberOfClusters that will be generated
* @param {boolean} [options.mutate=false] allows GeoJSON input to be mutated (significant performance increase if true)
* @returns {FeatureCollection<Point>} Clustered Points with an additional two properties associated to each Feature:
* - {number} cluster - the associated clusterId
* - {[number, number]} centroid - Centroid of the cluster [Longitude, Latitude]
* @example
* // create random points with random z-values in their properties
* var points = turf.randomPoint(100, {bbox: [0, 30, 20, 50]});
* var options = {numberOfClusters: 7};
* var clustered = turf.clustersKmeans(points, options);
*
* //addToMap
* var addToMap = [clustered];
*/
function clustersKmeans(points, options) {
if (options === void 0) { options = {}; }
// Default Params
var count = points.features.length;
options.numberOfClusters =
options.numberOfClusters || Math.round(Math.sqrt(count / 2));
// numberOfClusters can't be greater than the number of points
// fallbacks to count
if (options.numberOfClusters > count)
options.numberOfClusters = count;
// Clone points to prevent any mutations (enabled by default)
if (options.mutate !== true)
points = clone(points);
// collect points coordinates
var data = coordAll(points);
// create seed to avoid skmeans to drift
var initialCentroids = data.slice(0, options.numberOfClusters);
// create skmeans clusters
var skmeansResult = skmeans(data, options.numberOfClusters, initialCentroids);
// store centroids {clusterId: [number, number]}
var centroids = {};
skmeansResult.centroids.forEach(function (coord, idx) {
centroids[idx] = coord;
});
// add associated cluster number
featureEach(points, function (point, index) {
var clusterId = skmeansResult.idxs[index];
point.properties.cluster = clusterId;
point.properties.centroid = centroids[clusterId];
});
return points;
}
export default clustersKmeans;

View File

@@ -0,0 +1 @@
{"type":"module"}

View File

@@ -0,0 +1,31 @@
import { FeatureCollection, Point, Properties } from "@turf/helpers";
export declare type KmeansProps = Properties & {
cluster?: number;
centroid?: [number, number];
};
/**
* Takes a set of {@link Point|points} and partition them into clusters using the k-mean .
* It uses the [k-means algorithm](https://en.wikipedia.org/wiki/K-means_clustering)
*
* @name clustersKmeans
* @param {FeatureCollection<Point>} points to be clustered
* @param {Object} [options={}] Optional parameters
* @param {number} [options.numberOfClusters=Math.sqrt(numberOfPoints/2)] numberOfClusters that will be generated
* @param {boolean} [options.mutate=false] allows GeoJSON input to be mutated (significant performance increase if true)
* @returns {FeatureCollection<Point>} Clustered Points with an additional two properties associated to each Feature:
* - {number} cluster - the associated clusterId
* - {[number, number]} centroid - Centroid of the cluster [Longitude, Latitude]
* @example
* // create random points with random z-values in their properties
* var points = turf.randomPoint(100, {bbox: [0, 30, 20, 50]});
* var options = {numberOfClusters: 7};
* var clustered = turf.clustersKmeans(points, options);
*
* //addToMap
* var addToMap = [clustered];
*/
declare function clustersKmeans(points: FeatureCollection<Point>, options?: {
numberOfClusters?: number;
mutate?: boolean;
}): FeatureCollection<Point, KmeansProps>;
export default clustersKmeans;

62
frontend/node_modules/@turf/clusters-kmeans/dist/js/index.js generated vendored Executable file
View File

@@ -0,0 +1,62 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var clone_1 = __importDefault(require("@turf/clone"));
var meta_1 = require("@turf/meta");
var skmeans_1 = __importDefault(require("skmeans"));
/**
* Takes a set of {@link Point|points} and partition them into clusters using the k-mean .
* It uses the [k-means algorithm](https://en.wikipedia.org/wiki/K-means_clustering)
*
* @name clustersKmeans
* @param {FeatureCollection<Point>} points to be clustered
* @param {Object} [options={}] Optional parameters
* @param {number} [options.numberOfClusters=Math.sqrt(numberOfPoints/2)] numberOfClusters that will be generated
* @param {boolean} [options.mutate=false] allows GeoJSON input to be mutated (significant performance increase if true)
* @returns {FeatureCollection<Point>} Clustered Points with an additional two properties associated to each Feature:
* - {number} cluster - the associated clusterId
* - {[number, number]} centroid - Centroid of the cluster [Longitude, Latitude]
* @example
* // create random points with random z-values in their properties
* var points = turf.randomPoint(100, {bbox: [0, 30, 20, 50]});
* var options = {numberOfClusters: 7};
* var clustered = turf.clustersKmeans(points, options);
*
* //addToMap
* var addToMap = [clustered];
*/
function clustersKmeans(points, options) {
if (options === void 0) { options = {}; }
// Default Params
var count = points.features.length;
options.numberOfClusters =
options.numberOfClusters || Math.round(Math.sqrt(count / 2));
// numberOfClusters can't be greater than the number of points
// fallbacks to count
if (options.numberOfClusters > count)
options.numberOfClusters = count;
// Clone points to prevent any mutations (enabled by default)
if (options.mutate !== true)
points = clone_1.default(points);
// collect points coordinates
var data = meta_1.coordAll(points);
// create seed to avoid skmeans to drift
var initialCentroids = data.slice(0, options.numberOfClusters);
// create skmeans clusters
var skmeansResult = skmeans_1.default(data, options.numberOfClusters, initialCentroids);
// store centroids {clusterId: [number, number]}
var centroids = {};
skmeansResult.centroids.forEach(function (coord, idx) {
centroids[idx] = coord;
});
// add associated cluster number
meta_1.featureEach(points, function (point, index) {
var clusterId = skmeansResult.idxs[index];
point.properties.cluster = clusterId;
point.properties.centroid = centroids[clusterId];
});
return points;
}
exports.default = clustersKmeans;

View File

@@ -0,0 +1,82 @@
{
"name": "@turf/clusters-kmeans",
"version": "6.5.0",
"description": "turf clusters-kmeans module",
"author": "Turf Authors",
"contributors": [
"David Gómez Matarrodona <@solzimer>",
"Stefano Borghi <@stebogit>",
"Denis Carriere <@DenisCarriere>"
],
"license": "MIT",
"bugs": {
"url": "https://github.com/Turfjs/turf/issues"
},
"homepage": "https://github.com/Turfjs/turf",
"repository": {
"type": "git",
"url": "git://github.com/Turfjs/turf.git"
},
"funding": "https://opencollective.com/turf",
"publishConfig": {
"access": "public"
},
"keywords": [
"turf",
"geojson",
"cluster",
"clusters",
"clustering",
"k-means"
],
"main": "dist/js/index.js",
"module": "dist/es/index.js",
"exports": {
"./package.json": "./package.json",
".": {
"import": "./dist/es/index.js",
"require": "./dist/js/index.js"
}
},
"types": "dist/js/index.d.ts",
"sideEffects": false,
"files": [
"dist"
],
"scripts": {
"bench": "ts-node bench.js",
"build": "npm-run-all build:*",
"build:es": "tsc --outDir dist/es --module esnext --declaration false && echo '{\"type\":\"module\"}' > dist/es/package.json",
"build:js": "tsc",
"docs": "node ../../scripts/generate-readmes",
"test": "npm-run-all test:*",
"test:tape": "ts-node -r esm test.js",
"test:types": "tsc --esModuleInterop --noEmit types.ts"
},
"devDependencies": {
"@turf/centroid": "^6.5.0",
"@turf/clusters": "^6.5.0",
"@turf/random": "^6.5.0",
"@types/skmeans": "^0.11.2",
"@types/tape": "*",
"benchmark": "*",
"chromatism": "*",
"concaveman": "*",
"load-json-file": "*",
"matrix-to-grid": "*",
"npm-run-all": "*",
"tape": "*",
"ts-node": "*",
"tslint": "*",
"typescript": "*",
"write-json-file": "*"
},
"dependencies": {
"@turf/clone": "^6.5.0",
"@turf/helpers": "^6.5.0",
"@turf/invariant": "^6.5.0",
"@turf/meta": "^6.5.0",
"skmeans": "0.9.7"
},
"gitHead": "5375941072b90d489389db22b43bfe809d5e451e"
}