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/center-median/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.

103
frontend/node_modules/@turf/center-median/README.md generated vendored Normal file
View File

@@ -0,0 +1,103 @@
# @turf/center-median
<!-- Generated by documentation.js. Update this documentation by updating the source code. -->
## centerMedian
Takes a [FeatureCollection][1] of points and calculates the median center,
algorithimically. The median center is understood as the point that is
requires the least total travel from all other points.
Turfjs has four different functions for calculating the center of a set of
data. Each is useful depending on circumstance.
`@turf/center` finds the simple center of a dataset, by finding the
midpoint between the extents of the data. That is, it divides in half the
farthest east and farthest west point as well as the farthest north and
farthest south.
`@turf/center-of-mass` imagines that the dataset is a sheet of paper.
The center of mass is where the sheet would balance on a fingertip.
`@turf/center-mean` takes the averages of all the coordinates and
produces a value that respects that. Unlike `@turf/center`, it is
sensitive to clusters and outliers. It lands in the statistical middle of a
dataset, not the geographical. It can also be weighted, meaning certain
points are more important than others.
`@turf/center-median` takes the mean center and tries to find, iteratively,
a new point that requires the least amount of travel from all the points in
the dataset. It is not as sensitive to outliers as `@turf/center`, but it is
attracted to clustered data. It, too, can be weighted.
**Bibliography**
Harold W. Kuhn and Robert E. Kuenne, “An Efficient Algorithm for the
Numerical Solution of the Generalized Weber Problem in Spatial
Economics,” _Journal of Regional Science_ 4, no. 2 (1962): 2133,
doi:[https://doi.org/10.1111/j.1467-9787.1962.tb00902.x][2].
James E. Burt, Gerald M. Barber, and David L. Rigby, _Elementary
Statistics for Geographers_, 3rd ed., New York: The Guilford
Press, 2009, 150151.
**Parameters**
- `features` **[FeatureCollection][3]&lt;any>** Any GeoJSON Feature Collection
- `options` **[Object][4]** Optional parameters (optional, default `{}`)
- `options.weight` **[string][5]?** the property name used to weight the center
- `options.tolerance` **[number][6]** the difference in distance between candidate medians at which point the algorighim stops iterating. (optional, default `0.001`)
- `options.counter` **[number][6]** how many attempts to find the median, should the tolerance be insufficient. (optional, default `10`)
**Examples**
```javascript
var points = turf.points([[0, 0], [1, 0], [0, 1], [5, 8]]);
var medianCenter = turf.centerMedian(points);
//addToMap
var addToMap = [points, medianCenter]
```
Returns **[Feature][7]&lt;[Point][8]>** The median center of the collection
[1]: https://tools.ietf.org/html/rfc7946#section-3.3
[2]: https://doi.org/10.1111/j.1467-9787.1962.tb00902.x
[3]: https://tools.ietf.org/html/rfc7946#section-3.3
[4]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object
[5]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String
[6]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number
[7]: https://tools.ietf.org/html/rfc7946#section-3.2
[8]: https://tools.ietf.org/html/rfc7946#section-3.1.2
<!-- 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/center-median
```
Or install the Turf module that includes it as a function:
```sh
$ npm install @turf/turf
```

135
frontend/node_modules/@turf/center-median/dist/es/index.js generated vendored Executable file
View File

@@ -0,0 +1,135 @@
import centerMean from "@turf/center-mean";
import distance from "@turf/distance";
import centroid from "@turf/centroid";
import { isNumber, point, isObject, featureCollection, } from "@turf/helpers";
import { featureEach } from "@turf/meta";
/**
* Takes a {@link FeatureCollection} of points and calculates the median center,
* algorithimically. The median center is understood as the point that is
* requires the least total travel from all other points.
*
* Turfjs has four different functions for calculating the center of a set of
* data. Each is useful depending on circumstance.
*
* `@turf/center` finds the simple center of a dataset, by finding the
* midpoint between the extents of the data. That is, it divides in half the
* farthest east and farthest west point as well as the farthest north and
* farthest south.
*
* `@turf/center-of-mass` imagines that the dataset is a sheet of paper.
* The center of mass is where the sheet would balance on a fingertip.
*
* `@turf/center-mean` takes the averages of all the coordinates and
* produces a value that respects that. Unlike `@turf/center`, it is
* sensitive to clusters and outliers. It lands in the statistical middle of a
* dataset, not the geographical. It can also be weighted, meaning certain
* points are more important than others.
*
* `@turf/center-median` takes the mean center and tries to find, iteratively,
* a new point that requires the least amount of travel from all the points in
* the dataset. It is not as sensitive to outliers as `@turf/center-mean`, but it is
* attracted to clustered data. It, too, can be weighted.
*
* **Bibliography**
*
* Harold W. Kuhn and Robert E. Kuenne, “An Efficient Algorithm for the
* Numerical Solution of the Generalized Weber Problem in Spatial
* Economics,” _Journal of Regional Science_ 4, no. 2 (1962): 2133,
* doi:{@link https://doi.org/10.1111/j.1467-9787.1962.tb00902.x}.
*
* James E. Burt, Gerald M. Barber, and David L. Rigby, _Elementary
* Statistics for Geographers_, 3rd ed., New York: The Guilford
* Press, 2009, 150151.
*
* @name centerMedian
* @param {FeatureCollection<any>} features Any GeoJSON Feature Collection
* @param {Object} [options={}] Optional parameters
* @param {string} [options.weight] the property name used to weight the center
* @param {number} [options.tolerance=0.001] the difference in distance between candidate medians at which point the algorighim stops iterating.
* @param {number} [options.counter=10] how many attempts to find the median, should the tolerance be insufficient.
* @returns {Feature<Point>} The median center of the collection
* @example
* var points = turf.points([[0, 0], [1, 0], [0, 1], [5, 8]]);
* var medianCenter = turf.centerMedian(points);
*
* //addToMap
* var addToMap = [points, medianCenter]
*/
function centerMedian(features, options) {
if (options === void 0) { options = {}; }
// Optional params
options = options || {};
if (!isObject(options))
throw new Error("options is invalid");
var counter = options.counter || 10;
if (!isNumber(counter))
throw new Error("counter must be a number");
var weightTerm = options.weight;
// Calculate mean center:
var meanCenter = centerMean(features, { weight: options.weight });
// Calculate center of every feature:
var centroids = featureCollection([]);
featureEach(features, function (feature) {
var _a;
centroids.features.push(centroid(feature, {
properties: { weight: (_a = feature.properties) === null || _a === void 0 ? void 0 : _a[weightTerm] },
}));
});
var properties = {
tolerance: options.tolerance,
medianCandidates: [],
};
return findMedian(meanCenter.geometry.coordinates, [0, 0], centroids, properties, counter);
}
/**
* Recursive function to find new candidate medians.
*
* @private
* @param {Position} candidateMedian current candidate median
* @param {Position} previousCandidate the previous candidate median
* @param {FeatureCollection<Point>} centroids the collection of centroids whose median we are determining
* @param {number} counter how many attempts to try before quitting.
* @returns {Feature<Point>} the median center of the dataset.
*/
function findMedian(candidateMedian, previousCandidate, centroids, properties, counter) {
var tolerance = properties.tolerance || 0.001;
var candidateXsum = 0;
var candidateYsum = 0;
var kSum = 0;
var centroidCount = 0;
featureEach(centroids, function (theCentroid) {
var _a;
var weightValue = (_a = theCentroid.properties) === null || _a === void 0 ? void 0 : _a.weight;
var weight = weightValue === undefined || weightValue === null ? 1 : weightValue;
weight = Number(weight);
if (!isNumber(weight))
throw new Error("weight value must be a number");
if (weight > 0) {
centroidCount += 1;
var distanceFromCandidate = weight * distance(theCentroid, candidateMedian);
if (distanceFromCandidate === 0)
distanceFromCandidate = 1;
var k = weight / distanceFromCandidate;
candidateXsum += theCentroid.geometry.coordinates[0] * k;
candidateYsum += theCentroid.geometry.coordinates[1] * k;
kSum += k;
}
});
if (centroidCount < 1)
throw new Error("no features to measure");
var candidateX = candidateXsum / kSum;
var candidateY = candidateYsum / kSum;
if (centroidCount === 1 ||
counter === 0 ||
(Math.abs(candidateX - previousCandidate[0]) < tolerance &&
Math.abs(candidateY - previousCandidate[1]) < tolerance)) {
return point([candidateX, candidateY], {
medianCandidates: properties.medianCandidates,
});
}
else {
properties.medianCandidates.push([candidateX, candidateY]);
return findMedian([candidateX, candidateY], candidateMedian, centroids, properties, counter - 1);
}
}
export default centerMedian;

View File

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

62
frontend/node_modules/@turf/center-median/dist/js/index.d.ts generated vendored Executable file
View File

@@ -0,0 +1,62 @@
import { FeatureCollection, Feature, Point, Position } from "@turf/helpers";
/**
* Takes a {@link FeatureCollection} of points and calculates the median center,
* algorithimically. The median center is understood as the point that is
* requires the least total travel from all other points.
*
* Turfjs has four different functions for calculating the center of a set of
* data. Each is useful depending on circumstance.
*
* `@turf/center` finds the simple center of a dataset, by finding the
* midpoint between the extents of the data. That is, it divides in half the
* farthest east and farthest west point as well as the farthest north and
* farthest south.
*
* `@turf/center-of-mass` imagines that the dataset is a sheet of paper.
* The center of mass is where the sheet would balance on a fingertip.
*
* `@turf/center-mean` takes the averages of all the coordinates and
* produces a value that respects that. Unlike `@turf/center`, it is
* sensitive to clusters and outliers. It lands in the statistical middle of a
* dataset, not the geographical. It can also be weighted, meaning certain
* points are more important than others.
*
* `@turf/center-median` takes the mean center and tries to find, iteratively,
* a new point that requires the least amount of travel from all the points in
* the dataset. It is not as sensitive to outliers as `@turf/center-mean`, but it is
* attracted to clustered data. It, too, can be weighted.
*
* **Bibliography**
*
* Harold W. Kuhn and Robert E. Kuenne, “An Efficient Algorithm for the
* Numerical Solution of the Generalized Weber Problem in Spatial
* Economics,” _Journal of Regional Science_ 4, no. 2 (1962): 2133,
* doi:{@link https://doi.org/10.1111/j.1467-9787.1962.tb00902.x}.
*
* James E. Burt, Gerald M. Barber, and David L. Rigby, _Elementary
* Statistics for Geographers_, 3rd ed., New York: The Guilford
* Press, 2009, 150151.
*
* @name centerMedian
* @param {FeatureCollection<any>} features Any GeoJSON Feature Collection
* @param {Object} [options={}] Optional parameters
* @param {string} [options.weight] the property name used to weight the center
* @param {number} [options.tolerance=0.001] the difference in distance between candidate medians at which point the algorighim stops iterating.
* @param {number} [options.counter=10] how many attempts to find the median, should the tolerance be insufficient.
* @returns {Feature<Point>} The median center of the collection
* @example
* var points = turf.points([[0, 0], [1, 0], [0, 1], [5, 8]]);
* var medianCenter = turf.centerMedian(points);
*
* //addToMap
* var addToMap = [points, medianCenter]
*/
declare function centerMedian(features: FeatureCollection<any>, options?: {
weight?: string;
tolerance?: number;
counter?: number;
}): Feature<Point, {
medianCandidates: Array<Position>;
[key: string]: any;
}>;
export default centerMedian;

140
frontend/node_modules/@turf/center-median/dist/js/index.js generated vendored Executable file
View File

@@ -0,0 +1,140 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var center_mean_1 = __importDefault(require("@turf/center-mean"));
var distance_1 = __importDefault(require("@turf/distance"));
var centroid_1 = __importDefault(require("@turf/centroid"));
var helpers_1 = require("@turf/helpers");
var meta_1 = require("@turf/meta");
/**
* Takes a {@link FeatureCollection} of points and calculates the median center,
* algorithimically. The median center is understood as the point that is
* requires the least total travel from all other points.
*
* Turfjs has four different functions for calculating the center of a set of
* data. Each is useful depending on circumstance.
*
* `@turf/center` finds the simple center of a dataset, by finding the
* midpoint between the extents of the data. That is, it divides in half the
* farthest east and farthest west point as well as the farthest north and
* farthest south.
*
* `@turf/center-of-mass` imagines that the dataset is a sheet of paper.
* The center of mass is where the sheet would balance on a fingertip.
*
* `@turf/center-mean` takes the averages of all the coordinates and
* produces a value that respects that. Unlike `@turf/center`, it is
* sensitive to clusters and outliers. It lands in the statistical middle of a
* dataset, not the geographical. It can also be weighted, meaning certain
* points are more important than others.
*
* `@turf/center-median` takes the mean center and tries to find, iteratively,
* a new point that requires the least amount of travel from all the points in
* the dataset. It is not as sensitive to outliers as `@turf/center-mean`, but it is
* attracted to clustered data. It, too, can be weighted.
*
* **Bibliography**
*
* Harold W. Kuhn and Robert E. Kuenne, “An Efficient Algorithm for the
* Numerical Solution of the Generalized Weber Problem in Spatial
* Economics,” _Journal of Regional Science_ 4, no. 2 (1962): 2133,
* doi:{@link https://doi.org/10.1111/j.1467-9787.1962.tb00902.x}.
*
* James E. Burt, Gerald M. Barber, and David L. Rigby, _Elementary
* Statistics for Geographers_, 3rd ed., New York: The Guilford
* Press, 2009, 150151.
*
* @name centerMedian
* @param {FeatureCollection<any>} features Any GeoJSON Feature Collection
* @param {Object} [options={}] Optional parameters
* @param {string} [options.weight] the property name used to weight the center
* @param {number} [options.tolerance=0.001] the difference in distance between candidate medians at which point the algorighim stops iterating.
* @param {number} [options.counter=10] how many attempts to find the median, should the tolerance be insufficient.
* @returns {Feature<Point>} The median center of the collection
* @example
* var points = turf.points([[0, 0], [1, 0], [0, 1], [5, 8]]);
* var medianCenter = turf.centerMedian(points);
*
* //addToMap
* var addToMap = [points, medianCenter]
*/
function centerMedian(features, options) {
if (options === void 0) { options = {}; }
// Optional params
options = options || {};
if (!helpers_1.isObject(options))
throw new Error("options is invalid");
var counter = options.counter || 10;
if (!helpers_1.isNumber(counter))
throw new Error("counter must be a number");
var weightTerm = options.weight;
// Calculate mean center:
var meanCenter = center_mean_1.default(features, { weight: options.weight });
// Calculate center of every feature:
var centroids = helpers_1.featureCollection([]);
meta_1.featureEach(features, function (feature) {
var _a;
centroids.features.push(centroid_1.default(feature, {
properties: { weight: (_a = feature.properties) === null || _a === void 0 ? void 0 : _a[weightTerm] },
}));
});
var properties = {
tolerance: options.tolerance,
medianCandidates: [],
};
return findMedian(meanCenter.geometry.coordinates, [0, 0], centroids, properties, counter);
}
/**
* Recursive function to find new candidate medians.
*
* @private
* @param {Position} candidateMedian current candidate median
* @param {Position} previousCandidate the previous candidate median
* @param {FeatureCollection<Point>} centroids the collection of centroids whose median we are determining
* @param {number} counter how many attempts to try before quitting.
* @returns {Feature<Point>} the median center of the dataset.
*/
function findMedian(candidateMedian, previousCandidate, centroids, properties, counter) {
var tolerance = properties.tolerance || 0.001;
var candidateXsum = 0;
var candidateYsum = 0;
var kSum = 0;
var centroidCount = 0;
meta_1.featureEach(centroids, function (theCentroid) {
var _a;
var weightValue = (_a = theCentroid.properties) === null || _a === void 0 ? void 0 : _a.weight;
var weight = weightValue === undefined || weightValue === null ? 1 : weightValue;
weight = Number(weight);
if (!helpers_1.isNumber(weight))
throw new Error("weight value must be a number");
if (weight > 0) {
centroidCount += 1;
var distanceFromCandidate = weight * distance_1.default(theCentroid, candidateMedian);
if (distanceFromCandidate === 0)
distanceFromCandidate = 1;
var k = weight / distanceFromCandidate;
candidateXsum += theCentroid.geometry.coordinates[0] * k;
candidateYsum += theCentroid.geometry.coordinates[1] * k;
kSum += k;
}
});
if (centroidCount < 1)
throw new Error("no features to measure");
var candidateX = candidateXsum / kSum;
var candidateY = candidateYsum / kSum;
if (centroidCount === 1 ||
counter === 0 ||
(Math.abs(candidateX - previousCandidate[0]) < tolerance &&
Math.abs(candidateY - previousCandidate[1]) < tolerance)) {
return helpers_1.point([candidateX, candidateY], {
medianCandidates: properties.medianCandidates,
});
}
else {
properties.medianCandidates.push([candidateX, candidateY]);
return findMedian([candidateX, candidateY], candidateMedian, centroids, properties, counter - 1);
}
}
exports.default = centerMedian;

72
frontend/node_modules/@turf/center-median/package.json generated vendored Normal file
View File

@@ -0,0 +1,72 @@
{
"name": "@turf/center-median",
"version": "6.5.0",
"description": "turf center-median module",
"author": "Turf Authors",
"contributors": [
"Moacir P. de Sá Pereira <@muziejus>"
],
"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",
"center-median"
],
"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"
},
"devDependencies": {
"@turf/center": "^6.5.0",
"@turf/center-of-mass": "^6.5.0",
"@turf/random": "^6.5.0",
"@turf/truncate": "^6.5.0",
"@types/tape": "*",
"benchmark": "*",
"load-json-file": "*",
"npm-run-all": "*",
"tape": "*",
"ts-node": "*",
"tslint": "*",
"typescript": "*",
"write-json-file": "*"
},
"dependencies": {
"@turf/center-mean": "^6.5.0",
"@turf/centroid": "^6.5.0",
"@turf/distance": "^6.5.0",
"@turf/helpers": "^6.5.0",
"@turf/meta": "^6.5.0"
},
"gitHead": "5375941072b90d489389db22b43bfe809d5e451e"
}