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/line-split/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.

57
frontend/node_modules/@turf/line-split/README.md generated vendored Normal file
View File

@@ -0,0 +1,57 @@
# @turf/line-split
<!-- Generated by documentation.js. Update this documentation by updating the source code. -->
## lineSplit
Split a LineString by another GeoJSON Feature.
**Parameters**
- `line` **[Feature][1]&lt;[LineString][2]>** LineString Feature to split
- `splitter` **[Feature][1]&lt;any>** Feature used to split line
**Examples**
```javascript
var line = turf.lineString([[120, -25], [145, -25]]);
var splitter = turf.lineString([[130, -15], [130, -35]]);
var split = turf.lineSplit(line, splitter);
//addToMap
var addToMap = [line, splitter]
```
Returns **[FeatureCollection][3]&lt;[LineString][2]>** Split LineStrings
[1]: https://tools.ietf.org/html/rfc7946#section-3.2
[2]: https://tools.ietf.org/html/rfc7946#section-3.1.4
[3]: https://tools.ietf.org/html/rfc7946#section-3.3
<!-- 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/line-split
```
Or install the Turf module that includes it as a function:
```sh
$ npm install @turf/turf
```

215
frontend/node_modules/@turf/line-split/dist/es/index.js generated vendored Executable file
View File

@@ -0,0 +1,215 @@
import rbush from 'geojson-rbush';
import square from '@turf/square';
import bbox from '@turf/bbox';
import truncate from '@turf/truncate';
import lineSegment from '@turf/line-segment';
import lineIntersect from '@turf/line-intersect';
import nearestPointOnLine from '@turf/nearest-point-on-line';
import { getType, getCoords, getCoord } from '@turf/invariant';
import { flattenEach, featureEach, featureReduce } from '@turf/meta';
import { featureCollection, lineString } from '@turf/helpers';
/**
* Split a LineString by another GeoJSON Feature.
*
* @name lineSplit
* @param {Feature<LineString>} line LineString Feature to split
* @param {Feature<any>} splitter Feature used to split line
* @returns {FeatureCollection<LineString>} Split LineStrings
* @example
* var line = turf.lineString([[120, -25], [145, -25]]);
* var splitter = turf.lineString([[130, -15], [130, -35]]);
*
* var split = turf.lineSplit(line, splitter);
*
* //addToMap
* var addToMap = [line, splitter]
*/
function lineSplit(line, splitter) {
if (!line) throw new Error("line is required");
if (!splitter) throw new Error("splitter is required");
var lineType = getType(line);
var splitterType = getType(splitter);
if (lineType !== "LineString") throw new Error("line must be LineString");
if (splitterType === "FeatureCollection")
throw new Error("splitter cannot be a FeatureCollection");
if (splitterType === "GeometryCollection")
throw new Error("splitter cannot be a GeometryCollection");
// remove excessive decimals from splitter
// to avoid possible approximation issues in rbush
var truncatedSplitter = truncate(splitter, { precision: 7 });
switch (splitterType) {
case "Point":
return splitLineWithPoint(line, truncatedSplitter);
case "MultiPoint":
return splitLineWithPoints(line, truncatedSplitter);
case "LineString":
case "MultiLineString":
case "Polygon":
case "MultiPolygon":
return splitLineWithPoints(line, lineIntersect(line, truncatedSplitter));
}
}
/**
* Split LineString with MultiPoint
*
* @private
* @param {Feature<LineString>} line LineString
* @param {FeatureCollection<Point>} splitter Point
* @returns {FeatureCollection<LineString>} split LineStrings
*/
function splitLineWithPoints(line, splitter) {
var results = [];
var tree = rbush();
flattenEach(splitter, function (point) {
// Add index/id to features (needed for filter)
results.forEach(function (feature, index) {
feature.id = index;
});
// First Point - doesn't need to handle any previous line results
if (!results.length) {
results = splitLineWithPoint(line, point).features;
// Add Square BBox to each feature for GeoJSON-RBush
results.forEach(function (feature) {
if (!feature.bbox) feature.bbox = square(bbox(feature));
});
tree.load(featureCollection(results));
// Split with remaining points - lines might needed to be split multiple times
} else {
// Find all lines that are within the splitter's bbox
var search = tree.search(point);
if (search.features.length) {
// RBush might return multiple lines - only process the closest line to splitter
var closestLine = findClosestFeature(point, search);
// Remove closest line from results since this will be split into two lines
// This removes any duplicates inside the results & index
results = results.filter(function (feature) {
return feature.id !== closestLine.id;
});
tree.remove(closestLine);
// Append the two newly split lines into the results
featureEach(splitLineWithPoint(closestLine, point), function (line) {
results.push(line);
tree.insert(line);
});
}
}
});
return featureCollection(results);
}
/**
* Split LineString with Point
*
* @private
* @param {Feature<LineString>} line LineString
* @param {Feature<Point>} splitter Point
* @returns {FeatureCollection<LineString>} split LineStrings
*/
function splitLineWithPoint(line, splitter) {
var results = [];
// handle endpoints
var startPoint = getCoords(line)[0];
var endPoint = getCoords(line)[line.geometry.coordinates.length - 1];
if (
pointsEquals(startPoint, getCoord(splitter)) ||
pointsEquals(endPoint, getCoord(splitter))
)
return featureCollection([line]);
// Create spatial index
var tree = rbush();
var segments = lineSegment(line);
tree.load(segments);
// Find all segments that are within bbox of splitter
var search = tree.search(splitter);
// Return itself if point is not within spatial index
if (!search.features.length) return featureCollection([line]);
// RBush might return multiple lines - only process the closest line to splitter
var closestSegment = findClosestFeature(splitter, search);
// Initial value is the first point of the first segments (beginning of line)
var initialValue = [startPoint];
var lastCoords = featureReduce(
segments,
function (previous, current, index) {
var currentCoords = getCoords(current)[1];
var splitterCoords = getCoord(splitter);
// Location where segment intersects with line
if (index === closestSegment.id) {
previous.push(splitterCoords);
results.push(lineString(previous));
// Don't duplicate splitter coordinate (Issue #688)
if (pointsEquals(splitterCoords, currentCoords))
return [splitterCoords];
return [splitterCoords, currentCoords];
// Keep iterating over coords until finished or intersection is found
} else {
previous.push(currentCoords);
return previous;
}
},
initialValue
);
// Append last line to final split results
if (lastCoords.length > 1) {
results.push(lineString(lastCoords));
}
return featureCollection(results);
}
/**
* Find Closest Feature
*
* @private
* @param {Feature<Point>} point Feature must be closest to this point
* @param {FeatureCollection<LineString>} lines Collection of Features
* @returns {Feature<LineString>} closest LineString
*/
function findClosestFeature(point, lines) {
if (!lines.features.length) throw new Error("lines must contain features");
// Filter to one segment that is the closest to the line
if (lines.features.length === 1) return lines.features[0];
var closestFeature;
var closestDistance = Infinity;
featureEach(lines, function (segment) {
var pt = nearestPointOnLine(segment, point);
var dist = pt.properties.dist;
if (dist < closestDistance) {
closestFeature = segment;
closestDistance = dist;
}
});
return closestFeature;
}
/**
* Compares two points and returns if they are equals
*
* @private
* @param {Array<number>} pt1 point
* @param {Array<number>} pt2 point
* @returns {boolean} true if they are equals
*/
function pointsEquals(pt1, pt2) {
return pt1[0] === pt2[0] && pt1[1] === pt2[1];
}
export default lineSplit;

View File

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

228
frontend/node_modules/@turf/line-split/dist/js/index.js generated vendored Executable file
View File

@@ -0,0 +1,228 @@
'use strict';
var rbush = require('geojson-rbush');
var square = require('@turf/square');
var bbox = require('@turf/bbox');
var truncate = require('@turf/truncate');
var lineSegment = require('@turf/line-segment');
var lineIntersect = require('@turf/line-intersect');
var nearestPointOnLine = require('@turf/nearest-point-on-line');
var invariant = require('@turf/invariant');
var meta = require('@turf/meta');
var helpers = require('@turf/helpers');
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
var rbush__default = /*#__PURE__*/_interopDefaultLegacy(rbush);
var square__default = /*#__PURE__*/_interopDefaultLegacy(square);
var bbox__default = /*#__PURE__*/_interopDefaultLegacy(bbox);
var truncate__default = /*#__PURE__*/_interopDefaultLegacy(truncate);
var lineSegment__default = /*#__PURE__*/_interopDefaultLegacy(lineSegment);
var lineIntersect__default = /*#__PURE__*/_interopDefaultLegacy(lineIntersect);
var nearestPointOnLine__default = /*#__PURE__*/_interopDefaultLegacy(nearestPointOnLine);
/**
* Split a LineString by another GeoJSON Feature.
*
* @name lineSplit
* @param {Feature<LineString>} line LineString Feature to split
* @param {Feature<any>} splitter Feature used to split line
* @returns {FeatureCollection<LineString>} Split LineStrings
* @example
* var line = turf.lineString([[120, -25], [145, -25]]);
* var splitter = turf.lineString([[130, -15], [130, -35]]);
*
* var split = turf.lineSplit(line, splitter);
*
* //addToMap
* var addToMap = [line, splitter]
*/
function lineSplit(line, splitter) {
if (!line) throw new Error("line is required");
if (!splitter) throw new Error("splitter is required");
var lineType = invariant.getType(line);
var splitterType = invariant.getType(splitter);
if (lineType !== "LineString") throw new Error("line must be LineString");
if (splitterType === "FeatureCollection")
throw new Error("splitter cannot be a FeatureCollection");
if (splitterType === "GeometryCollection")
throw new Error("splitter cannot be a GeometryCollection");
// remove excessive decimals from splitter
// to avoid possible approximation issues in rbush
var truncatedSplitter = truncate__default['default'](splitter, { precision: 7 });
switch (splitterType) {
case "Point":
return splitLineWithPoint(line, truncatedSplitter);
case "MultiPoint":
return splitLineWithPoints(line, truncatedSplitter);
case "LineString":
case "MultiLineString":
case "Polygon":
case "MultiPolygon":
return splitLineWithPoints(line, lineIntersect__default['default'](line, truncatedSplitter));
}
}
/**
* Split LineString with MultiPoint
*
* @private
* @param {Feature<LineString>} line LineString
* @param {FeatureCollection<Point>} splitter Point
* @returns {FeatureCollection<LineString>} split LineStrings
*/
function splitLineWithPoints(line, splitter) {
var results = [];
var tree = rbush__default['default']();
meta.flattenEach(splitter, function (point) {
// Add index/id to features (needed for filter)
results.forEach(function (feature, index) {
feature.id = index;
});
// First Point - doesn't need to handle any previous line results
if (!results.length) {
results = splitLineWithPoint(line, point).features;
// Add Square BBox to each feature for GeoJSON-RBush
results.forEach(function (feature) {
if (!feature.bbox) feature.bbox = square__default['default'](bbox__default['default'](feature));
});
tree.load(helpers.featureCollection(results));
// Split with remaining points - lines might needed to be split multiple times
} else {
// Find all lines that are within the splitter's bbox
var search = tree.search(point);
if (search.features.length) {
// RBush might return multiple lines - only process the closest line to splitter
var closestLine = findClosestFeature(point, search);
// Remove closest line from results since this will be split into two lines
// This removes any duplicates inside the results & index
results = results.filter(function (feature) {
return feature.id !== closestLine.id;
});
tree.remove(closestLine);
// Append the two newly split lines into the results
meta.featureEach(splitLineWithPoint(closestLine, point), function (line) {
results.push(line);
tree.insert(line);
});
}
}
});
return helpers.featureCollection(results);
}
/**
* Split LineString with Point
*
* @private
* @param {Feature<LineString>} line LineString
* @param {Feature<Point>} splitter Point
* @returns {FeatureCollection<LineString>} split LineStrings
*/
function splitLineWithPoint(line, splitter) {
var results = [];
// handle endpoints
var startPoint = invariant.getCoords(line)[0];
var endPoint = invariant.getCoords(line)[line.geometry.coordinates.length - 1];
if (
pointsEquals(startPoint, invariant.getCoord(splitter)) ||
pointsEquals(endPoint, invariant.getCoord(splitter))
)
return helpers.featureCollection([line]);
// Create spatial index
var tree = rbush__default['default']();
var segments = lineSegment__default['default'](line);
tree.load(segments);
// Find all segments that are within bbox of splitter
var search = tree.search(splitter);
// Return itself if point is not within spatial index
if (!search.features.length) return helpers.featureCollection([line]);
// RBush might return multiple lines - only process the closest line to splitter
var closestSegment = findClosestFeature(splitter, search);
// Initial value is the first point of the first segments (beginning of line)
var initialValue = [startPoint];
var lastCoords = meta.featureReduce(
segments,
function (previous, current, index) {
var currentCoords = invariant.getCoords(current)[1];
var splitterCoords = invariant.getCoord(splitter);
// Location where segment intersects with line
if (index === closestSegment.id) {
previous.push(splitterCoords);
results.push(helpers.lineString(previous));
// Don't duplicate splitter coordinate (Issue #688)
if (pointsEquals(splitterCoords, currentCoords))
return [splitterCoords];
return [splitterCoords, currentCoords];
// Keep iterating over coords until finished or intersection is found
} else {
previous.push(currentCoords);
return previous;
}
},
initialValue
);
// Append last line to final split results
if (lastCoords.length > 1) {
results.push(helpers.lineString(lastCoords));
}
return helpers.featureCollection(results);
}
/**
* Find Closest Feature
*
* @private
* @param {Feature<Point>} point Feature must be closest to this point
* @param {FeatureCollection<LineString>} lines Collection of Features
* @returns {Feature<LineString>} closest LineString
*/
function findClosestFeature(point, lines) {
if (!lines.features.length) throw new Error("lines must contain features");
// Filter to one segment that is the closest to the line
if (lines.features.length === 1) return lines.features[0];
var closestFeature;
var closestDistance = Infinity;
meta.featureEach(lines, function (segment) {
var pt = nearestPointOnLine__default['default'](segment, point);
var dist = pt.properties.dist;
if (dist < closestDistance) {
closestFeature = segment;
closestDistance = dist;
}
});
return closestFeature;
}
/**
* Compares two points and returns if they are equals
*
* @private
* @param {Array<number>} pt1 point
* @param {Array<number>} pt2 point
* @returns {boolean} true if they are equals
*/
function pointsEquals(pt1, pt2) {
return pt1[0] === pt2[0] && pt1[1] === pt2[1];
}
module.exports = lineSplit;
module.exports.default = lineSplit;

22
frontend/node_modules/@turf/line-split/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,22 @@
import {
Feature,
FeatureCollection,
Point,
MultiPoint,
LineString,
MultiLineString,
Polygon,
MultiPolygon,
} from "@turf/helpers";
export type Splitter = Feature<
Point | MultiPoint | LineString | MultiLineString | Polygon | MultiPolygon
>;
/**
* http://turfjs.org/docs/#linesplit
*/
export default function lineSplit<T extends LineString>(
line: Feature<T> | T,
splitter: Splitter
): FeatureCollection<T>;

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

@@ -0,0 +1,72 @@
{
"name": "@turf/line-split",
"version": "6.5.0",
"description": "turf line-split module",
"author": "Turf Authors",
"contributors": [
"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",
"gis",
"line",
"split"
],
"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": "index.d.ts",
"sideEffects": false,
"files": [
"dist",
"index.d.ts"
],
"scripts": {
"bench": "node -r esm bench.js",
"build": "rollup -c ../../rollup.config.js && echo '{\"type\":\"module\"}' > dist/es/package.json",
"docs": "node ../../scripts/generate-readmes",
"test": "npm-run-all test:*",
"test:tape": "node -r esm test.js"
},
"devDependencies": {
"benchmark": "*",
"load-json-file": "*",
"npm-run-all": "*",
"rollup": "*",
"tape": "*",
"write-json-file": "*"
},
"dependencies": {
"@turf/bbox": "^6.5.0",
"@turf/helpers": "^6.5.0",
"@turf/invariant": "^6.5.0",
"@turf/line-intersect": "^6.5.0",
"@turf/line-segment": "^6.5.0",
"@turf/meta": "^6.5.0",
"@turf/nearest-point-on-line": "^6.5.0",
"@turf/square": "^6.5.0",
"@turf/truncate": "^6.5.0",
"geojson-rbush": "3.x"
},
"gitHead": "5375941072b90d489389db22b43bfe809d5e451e"
}