@turf/point-on-feature 7.1.0 → 7.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.cjs +2 -2
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.cts +1 -1
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.js +2 -2
- package/dist/esm/index.js.map +1 -1
- package/package.json +17 -17
package/dist/cjs/index.cjs
CHANGED
|
@@ -97,9 +97,9 @@ function pointOnSegment(x, y, x1, y1, x2, y2) {
|
|
|
97
97
|
const pb = Math.sqrt((x2 - x) * (x2 - x) + (y2 - y) * (y2 - y));
|
|
98
98
|
return ab === ap + pb;
|
|
99
99
|
}
|
|
100
|
-
var
|
|
100
|
+
var index_default = pointOnFeature;
|
|
101
101
|
|
|
102
102
|
|
|
103
103
|
|
|
104
|
-
exports.default =
|
|
104
|
+
exports.default = index_default; exports.pointOnFeature = pointOnFeature;
|
|
105
105
|
//# sourceMappingURL=index.cjs.map
|
package/dist/cjs/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../index.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/turf/turf/packages/turf-point-on-feature/dist/cjs/index.cjs","../../index.ts"],"names":[],"mappings":"AAAA;ACEA,wCAAwB;AACxB,sCAAmC;AACnC,mDAA6B;AAC7B,uEAAsC;AACtC,wCAAkD;AA4BlD,SAAS,cAAA,CAAe,OAAA,EAAqC;AAE3D,EAAA,MAAM,GAAA,EAAK,SAAA,CAAU,OAAO,CAAA;AAG5B,EAAA,MAAM,KAAA,EAAO,4BAAA,EAAW,CAAA;AAGxB,EAAA,IAAI,UAAA,EAAY,KAAA;AAChB,EAAA,IAAI,EAAA,EAAI,CAAA;AACR,EAAA,MAAA,CAAO,CAAC,UAAA,GAAa,EAAA,EAAI,EAAA,CAAG,QAAA,CAAS,MAAA,EAAQ;AAC3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IAAO,GAAA,EAAK,EAAA;AACrB;AAGA,IAAO,cAAA,EAAQ,cAAA;AD1Df;AACE;AACA;AACF,yEAAC","file":"/home/runner/work/turf/turf/packages/turf-point-on-feature/dist/cjs/index.cjs","sourcesContent":[null,"import type { Feature, Point } from \"geojson\";\nimport type { AllGeoJSON } from \"@turf/helpers\";\nimport { explode } from \"@turf/explode\";\nimport { center as centroid } from \"@turf/center\";\nimport { nearestPoint } from \"@turf/nearest-point\";\nimport { booleanPointInPolygon } from \"@turf/boolean-point-in-polygon\";\nimport { featureCollection, feature, point } from \"@turf/helpers\";\n\n/**\n * Takes a Feature or FeatureCollection and returns a {@link Point} guaranteed to be on the surface of the feature.\n *\n * * Given a {@link Polygon}, the point will be in the area of the polygon\n * * Given a {@link LineString}, the point will be along the string\n * * Given a {@link Point}, the point will the same as the input\n *\n * @function\n * @param {GeoJSON} geojson any Feature or FeatureCollection\n * @returns {Feature<Point>} a point on the surface of `input`\n * @example\n * var polygon = turf.polygon([[\n * [116, -36],\n * [131, -32],\n * [146, -43],\n * [155, -25],\n * [133, -9],\n * [111, -22],\n * [116, -36]\n * ]]);\n *\n * var pointOnPolygon = turf.pointOnFeature(polygon);\n *\n * //addToMap\n * var addToMap = [polygon, pointOnPolygon];\n */\nfunction pointOnFeature(geojson: AllGeoJSON): Feature<Point> {\n // normalize\n const fc = normalize(geojson);\n\n // get centroid\n const cent = centroid(fc);\n\n // check to see if centroid is on surface\n let onSurface = false;\n let i = 0;\n while (!onSurface && i < fc.features.length) {\n const geom = fc.features[i].geometry;\n let x, y, x1, y1, x2, y2;\n let onLine = false;\n if (geom.type === \"Point\") {\n if (\n cent.geometry.coordinates[0] === geom.coordinates[0] &&\n cent.geometry.coordinates[1] === geom.coordinates[1]\n ) {\n onSurface = true;\n }\n } else if (geom.type === \"MultiPoint\") {\n let onMultiPoint = false;\n let k = 0;\n while (!onMultiPoint && k < geom.coordinates.length) {\n if (\n cent.geometry.coordinates[0] === geom.coordinates[k][0] &&\n cent.geometry.coordinates[1] === geom.coordinates[k][1]\n ) {\n onSurface = true;\n onMultiPoint = true;\n }\n k++;\n }\n } else if (geom.type === \"LineString\") {\n let k = 0;\n while (!onLine && k < geom.coordinates.length - 1) {\n x = cent.geometry.coordinates[0];\n y = cent.geometry.coordinates[1];\n x1 = geom.coordinates[k][0];\n y1 = geom.coordinates[k][1];\n x2 = geom.coordinates[k + 1][0];\n y2 = geom.coordinates[k + 1][1];\n if (pointOnSegment(x, y, x1, y1, x2, y2)) {\n onLine = true;\n onSurface = true;\n }\n k++;\n }\n } else if (geom.type === \"MultiLineString\") {\n let j = 0;\n while (j < geom.coordinates.length) {\n onLine = false;\n let k = 0;\n const line = geom.coordinates[j];\n while (!onLine && k < line.length - 1) {\n x = cent.geometry.coordinates[0];\n y = cent.geometry.coordinates[1];\n x1 = line[k][0];\n y1 = line[k][1];\n x2 = line[k + 1][0];\n y2 = line[k + 1][1];\n if (pointOnSegment(x, y, x1, y1, x2, y2)) {\n onLine = true;\n onSurface = true;\n }\n k++;\n }\n j++;\n }\n } else if (geom.type === \"Polygon\" || geom.type === \"MultiPolygon\") {\n if (booleanPointInPolygon(cent, geom)) {\n onSurface = true;\n }\n }\n i++;\n }\n if (onSurface) {\n return cent;\n } else {\n const vertices = featureCollection<Point>([]);\n for (let f = 0; f < fc.features.length; f++) {\n vertices.features = vertices.features.concat(\n explode(fc.features[f]).features\n );\n }\n // Remove distanceToPoint properties from nearestPoint()\n return point(nearestPoint(cent, vertices).geometry.coordinates);\n }\n}\n\n/**\n * Normalizes any GeoJSON to a FeatureCollection\n *\n * @private\n * @name normalize\n * @param {GeoJSON} geojson Any GeoJSON\n * @returns {FeatureCollection} FeatureCollection\n */\nfunction normalize(geojson: AllGeoJSON) {\n if (geojson.type !== \"FeatureCollection\") {\n if (geojson.type !== \"Feature\") {\n return featureCollection([feature(geojson)]);\n }\n return featureCollection([geojson]);\n }\n return geojson;\n}\n\nfunction pointOnSegment(\n x: number,\n y: number,\n x1: number,\n y1: number,\n x2: number,\n y2: number\n) {\n const ab = Math.sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1));\n const ap = Math.sqrt((x - x1) * (x - x1) + (y - y1) * (y - y1));\n const pb = Math.sqrt((x2 - x) * (x2 - x) + (y2 - y) * (y2 - y));\n return ab === ap + pb;\n}\n\nexport { pointOnFeature };\nexport default pointOnFeature;\n"]}
|
package/dist/cjs/index.d.cts
CHANGED
|
@@ -8,7 +8,7 @@ import { AllGeoJSON } from '@turf/helpers';
|
|
|
8
8
|
* * Given a {@link LineString}, the point will be along the string
|
|
9
9
|
* * Given a {@link Point}, the point will the same as the input
|
|
10
10
|
*
|
|
11
|
-
* @
|
|
11
|
+
* @function
|
|
12
12
|
* @param {GeoJSON} geojson any Feature or FeatureCollection
|
|
13
13
|
* @returns {Feature<Point>} a point on the surface of `input`
|
|
14
14
|
* @example
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ import { AllGeoJSON } from '@turf/helpers';
|
|
|
8
8
|
* * Given a {@link LineString}, the point will be along the string
|
|
9
9
|
* * Given a {@link Point}, the point will the same as the input
|
|
10
10
|
*
|
|
11
|
-
* @
|
|
11
|
+
* @function
|
|
12
12
|
* @param {GeoJSON} geojson any Feature or FeatureCollection
|
|
13
13
|
* @returns {Feature<Point>} a point on the surface of `input`
|
|
14
14
|
* @example
|
package/dist/esm/index.js
CHANGED
|
@@ -97,9 +97,9 @@ function pointOnSegment(x, y, x1, y1, x2, y2) {
|
|
|
97
97
|
const pb = Math.sqrt((x2 - x) * (x2 - x) + (y2 - y) * (y2 - y));
|
|
98
98
|
return ab === ap + pb;
|
|
99
99
|
}
|
|
100
|
-
var
|
|
100
|
+
var index_default = pointOnFeature;
|
|
101
101
|
export {
|
|
102
|
-
|
|
102
|
+
index_default as default,
|
|
103
103
|
pointOnFeature
|
|
104
104
|
};
|
|
105
105
|
//# sourceMappingURL=index.js.map
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../index.ts"],"sourcesContent":["import type { Feature, Point } from \"geojson\";\nimport type { AllGeoJSON } from \"@turf/helpers\";\nimport { explode } from \"@turf/explode\";\nimport { center as centroid } from \"@turf/center\";\nimport { nearestPoint } from \"@turf/nearest-point\";\nimport { booleanPointInPolygon } from \"@turf/boolean-point-in-polygon\";\nimport { featureCollection, feature, point } from \"@turf/helpers\";\n\n/**\n * Takes a Feature or FeatureCollection and returns a {@link Point} guaranteed to be on the surface of the feature.\n *\n * * Given a {@link Polygon}, the point will be in the area of the polygon\n * * Given a {@link LineString}, the point will be along the string\n * * Given a {@link Point}, the point will the same as the input\n *\n * @
|
|
1
|
+
{"version":3,"sources":["../../index.ts"],"sourcesContent":["import type { Feature, Point } from \"geojson\";\nimport type { AllGeoJSON } from \"@turf/helpers\";\nimport { explode } from \"@turf/explode\";\nimport { center as centroid } from \"@turf/center\";\nimport { nearestPoint } from \"@turf/nearest-point\";\nimport { booleanPointInPolygon } from \"@turf/boolean-point-in-polygon\";\nimport { featureCollection, feature, point } from \"@turf/helpers\";\n\n/**\n * Takes a Feature or FeatureCollection and returns a {@link Point} guaranteed to be on the surface of the feature.\n *\n * * Given a {@link Polygon}, the point will be in the area of the polygon\n * * Given a {@link LineString}, the point will be along the string\n * * Given a {@link Point}, the point will the same as the input\n *\n * @function\n * @param {GeoJSON} geojson any Feature or FeatureCollection\n * @returns {Feature<Point>} a point on the surface of `input`\n * @example\n * var polygon = turf.polygon([[\n * [116, -36],\n * [131, -32],\n * [146, -43],\n * [155, -25],\n * [133, -9],\n * [111, -22],\n * [116, -36]\n * ]]);\n *\n * var pointOnPolygon = turf.pointOnFeature(polygon);\n *\n * //addToMap\n * var addToMap = [polygon, pointOnPolygon];\n */\nfunction pointOnFeature(geojson: AllGeoJSON): Feature<Point> {\n // normalize\n const fc = normalize(geojson);\n\n // get centroid\n const cent = centroid(fc);\n\n // check to see if centroid is on surface\n let onSurface = false;\n let i = 0;\n while (!onSurface && i < fc.features.length) {\n const geom = fc.features[i].geometry;\n let x, y, x1, y1, x2, y2;\n let onLine = false;\n if (geom.type === \"Point\") {\n if (\n cent.geometry.coordinates[0] === geom.coordinates[0] &&\n cent.geometry.coordinates[1] === geom.coordinates[1]\n ) {\n onSurface = true;\n }\n } else if (geom.type === \"MultiPoint\") {\n let onMultiPoint = false;\n let k = 0;\n while (!onMultiPoint && k < geom.coordinates.length) {\n if (\n cent.geometry.coordinates[0] === geom.coordinates[k][0] &&\n cent.geometry.coordinates[1] === geom.coordinates[k][1]\n ) {\n onSurface = true;\n onMultiPoint = true;\n }\n k++;\n }\n } else if (geom.type === \"LineString\") {\n let k = 0;\n while (!onLine && k < geom.coordinates.length - 1) {\n x = cent.geometry.coordinates[0];\n y = cent.geometry.coordinates[1];\n x1 = geom.coordinates[k][0];\n y1 = geom.coordinates[k][1];\n x2 = geom.coordinates[k + 1][0];\n y2 = geom.coordinates[k + 1][1];\n if (pointOnSegment(x, y, x1, y1, x2, y2)) {\n onLine = true;\n onSurface = true;\n }\n k++;\n }\n } else if (geom.type === \"MultiLineString\") {\n let j = 0;\n while (j < geom.coordinates.length) {\n onLine = false;\n let k = 0;\n const line = geom.coordinates[j];\n while (!onLine && k < line.length - 1) {\n x = cent.geometry.coordinates[0];\n y = cent.geometry.coordinates[1];\n x1 = line[k][0];\n y1 = line[k][1];\n x2 = line[k + 1][0];\n y2 = line[k + 1][1];\n if (pointOnSegment(x, y, x1, y1, x2, y2)) {\n onLine = true;\n onSurface = true;\n }\n k++;\n }\n j++;\n }\n } else if (geom.type === \"Polygon\" || geom.type === \"MultiPolygon\") {\n if (booleanPointInPolygon(cent, geom)) {\n onSurface = true;\n }\n }\n i++;\n }\n if (onSurface) {\n return cent;\n } else {\n const vertices = featureCollection<Point>([]);\n for (let f = 0; f < fc.features.length; f++) {\n vertices.features = vertices.features.concat(\n explode(fc.features[f]).features\n );\n }\n // Remove distanceToPoint properties from nearestPoint()\n return point(nearestPoint(cent, vertices).geometry.coordinates);\n }\n}\n\n/**\n * Normalizes any GeoJSON to a FeatureCollection\n *\n * @private\n * @name normalize\n * @param {GeoJSON} geojson Any GeoJSON\n * @returns {FeatureCollection} FeatureCollection\n */\nfunction normalize(geojson: AllGeoJSON) {\n if (geojson.type !== \"FeatureCollection\") {\n if (geojson.type !== \"Feature\") {\n return featureCollection([feature(geojson)]);\n }\n return featureCollection([geojson]);\n }\n return geojson;\n}\n\nfunction pointOnSegment(\n x: number,\n y: number,\n x1: number,\n y1: number,\n x2: number,\n y2: number\n) {\n const ab = Math.sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1));\n const ap = Math.sqrt((x - x1) * (x - x1) + (y - y1) * (y - y1));\n const pb = Math.sqrt((x2 - x) * (x2 - x) + (y2 - y) * (y2 - y));\n return ab === ap + pb;\n}\n\nexport { pointOnFeature };\nexport default pointOnFeature;\n"],"mappings":";AAEA,SAAS,eAAe;AACxB,SAAS,UAAU,gBAAgB;AACnC,SAAS,oBAAoB;AAC7B,SAAS,6BAA6B;AACtC,SAAS,mBAAmB,SAAS,aAAa;AA4BlD,SAAS,eAAe,SAAqC;AAE3D,QAAM,KAAK,UAAU,OAAO;AAG5B,QAAM,OAAO,SAAS,EAAE;AAGxB,MAAI,YAAY;AAChB,MAAI,IAAI;AACR,SAAO,CAAC,aAAa,IAAI,GAAG,SAAS,QAAQ;AAC3C,UAAM,OAAO,GAAG,SAAS,CAAC,EAAE;AAC5B,QAAI,GAAG,GAAG,IAAI,IAAI,IAAI;AACtB,QAAI,SAAS;AACb,QAAI,KAAK,SAAS,SAAS;AACzB,UACE,KAAK,SAAS,YAAY,CAAC,MAAM,KAAK,YAAY,CAAC,KACnD,KAAK,SAAS,YAAY,CAAC,MAAM,KAAK,YAAY,CAAC,GACnD;AACA,oBAAY;AAAA,MACd;AAAA,IACF,WAAW,KAAK,SAAS,cAAc;AACrC,UAAI,eAAe;AACnB,UAAI,IAAI;AACR,aAAO,CAAC,gBAAgB,IA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;AAAA,QACF;AACA;AAAA,MACF;AAAA,IACF,WAAW,KAAK,SAAS,aAAa,KAAK,SAAS,gBAAgB;AAClE,UAAI,sBAAsB,MAAM,IAAI,GAAG;AACrC,oBAAY;AAAA,MACd;AAAA,IACF;AACA;AAAA,EACF;AACA,MAAI,WAAW;AACb,WAAO;AAAA,EACT,OAAO;AACL,UAAM,WAAW,kBAAyB,CAAC,CAAC;AAC5C,aAAS,IAAI,GAAG,IAAI,GAAG,SAAS,QAAQ,KAAK;AAC3C,eAAS,WAAW,SAAS,SAAS;AAAA,QACpC,QAAQ,GAAG,SAAS,CAAC,CAAC,EAAE;AAAA,MAC1B;AAAA,IACF;AAEA,WAAO,MAAM,aAAa,MAAM,QAAQ,EAAE,SAAS,WAAW;AAAA,EAChE;AACF;AAUA,SAAS,UAAU,SAAqB;AACtC,MAAI,QAAQ,SAAS,qBAAqB;AACxC,QAAI,QAAQ,SAAS,WAAW;AAC9B,aAAO,kBAAkB,CAAC,QAAQ,OAAO,CAAC,CAAC;AAAA,IAC7C;AACA,WAAO,kBAAkB,CAAC,OAAO,CAAC;AAAA,EACpC;AACA,SAAO;AACT;AAEA,SAAS,eACP,GACA,GACA,IACA,IACA,IACA,IACA;AACA,QAAM,KAAK,KAAK,MAAM,KAAK,OAAO,KAAK,OAAO,KAAK,OAAO,KAAK,GAAG;AAClE,QAAM,KAAK,KAAK,MAAM,IAAI,OAAO,IAAI,OAAO,IAAI,OAAO,IAAI,GAAG;AAC9D,QAAM,KAAK,KAAK,MAAM,KAAK,MAAM,KAAK,MAAM,KAAK,MAAM,KAAK,EAAE;AAC9D,SAAO,OAAO,KAAK;AACrB;AAGA,IAAO,gBAAQ;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@turf/point-on-feature",
|
|
3
|
-
"version": "7.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "7.3.0",
|
|
4
|
+
"description": "Takes a Feature or FeatureCollection and returns a Point guaranteed to be on the surface of the feature.",
|
|
5
5
|
"author": "Turf Authors",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"bugs": {
|
|
@@ -53,26 +53,26 @@
|
|
|
53
53
|
"test:tape": "tsx test.ts"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
|
-
"@turf/meta": "
|
|
57
|
-
"@turf/truncate": "
|
|
56
|
+
"@turf/meta": "7.3.0",
|
|
57
|
+
"@turf/truncate": "7.3.0",
|
|
58
58
|
"@types/benchmark": "^2.1.5",
|
|
59
|
-
"@types/tape": "^
|
|
59
|
+
"@types/tape": "^5.8.1",
|
|
60
60
|
"benchmark": "^2.1.4",
|
|
61
61
|
"npm-run-all": "^4.1.5",
|
|
62
|
-
"tape": "^5.
|
|
63
|
-
"tsup": "^8.0
|
|
64
|
-
"tsx": "^4.
|
|
65
|
-
"typescript": "^5.
|
|
66
|
-
"write-json-file": "^
|
|
62
|
+
"tape": "^5.9.0",
|
|
63
|
+
"tsup": "^8.4.0",
|
|
64
|
+
"tsx": "^4.19.4",
|
|
65
|
+
"typescript": "^5.8.3",
|
|
66
|
+
"write-json-file": "^6.0.0"
|
|
67
67
|
},
|
|
68
68
|
"dependencies": {
|
|
69
|
-
"@turf/boolean-point-in-polygon": "
|
|
70
|
-
"@turf/center": "
|
|
71
|
-
"@turf/explode": "
|
|
72
|
-
"@turf/helpers": "
|
|
73
|
-
"@turf/nearest-point": "
|
|
69
|
+
"@turf/boolean-point-in-polygon": "7.3.0",
|
|
70
|
+
"@turf/center": "7.3.0",
|
|
71
|
+
"@turf/explode": "7.3.0",
|
|
72
|
+
"@turf/helpers": "7.3.0",
|
|
73
|
+
"@turf/nearest-point": "7.3.0",
|
|
74
74
|
"@types/geojson": "^7946.0.10",
|
|
75
|
-
"tslib": "^2.
|
|
75
|
+
"tslib": "^2.8.1"
|
|
76
76
|
},
|
|
77
|
-
"gitHead": "
|
|
77
|
+
"gitHead": "9f58a103e8f9a587ab640307ed03ba5233913ddd"
|
|
78
78
|
}
|