@turf/points-within-polygon 7.1.0 → 7.2.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.map +1 -1
- package/dist/cjs/index.d.cts +1 -1
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.js.map +1 -1
- package/package.json +11 -11
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-points-within-polygon/dist/cjs/index.cjs","../../index.ts"],"names":[],"mappings":"AAAA;ACUA,uEAAwD;AACxD,wCAA8C;AAC9C,kCAAiD;AAqCjD,SAAS,mBAAA,CAIP,MAAA,EAGA,QAAA,EAC0C;AAC1C,EAAA,MAAM,QAAA,EAA4C,CAAC,CAAA;AACnD,EAAA,+BAAA,MAAY,EAAQ,QAAA,CAAU,KAAA,EAAO;AACnC,IAAA,IAAI,UAAA,EAAY,KAAA;AAChB,IAAA,GAAA,CAAI,KAAA,CAAM,QAAA,CAAS,KAAA,IAAS,OAAA,EAAS;AACnC,MAAA,4BAAA,QAAS,EAAU,QAAA,CAAU,OAAA,EAAS;AACpC,QAAA,GAAA,CAAI,0DAAA,KAAe,EAA4B,OAAO,CAAA,EAAG;AACvD,UAAA,UAAA,EAAY,IAAA;AAAA,QACd;AAAA,MACF,CAAC,CAAA;AACD,MAAA,GAAA,CAAI,SAAA,EAAW;AACb,QAAA,OAAA,CAAQ,IAAA,CAAK,KAAK,CAAA;AAAA,MACpB;AAAA,IACF,EAAA,KAAA,GAAA,CAAW,KAAA,CAAM,QAAA,CAAS,KAAA,IAAS,YAAA,EAAc;AAC/C,MAAA,IAAI,aAAA,EAA2B,CAAC,CAAA;AAChC,MAAA,4BAAA,QAAS,EAAU,QAAA,CAAU,OAAA,EAAS;AACpC,QAAA,6BAAA,KAAU,EAA8B,QAAA,CAAU,UAAA,EAAY;AAC5D,UAAA,GAAA,CAAI,0DAAA,UAAe,EAAY,OAAO,CAAA,EAAG;AACvC,YAAA,UAAA,EAAY,IAAA;AACZ,YAAA,YAAA,CAAa,IAAA,CAAK,UAAU,CAAA;AAAA,UAC9B;AAAA,QACF,CAAC,CAAA;AAAA,MACH,CAAC,CAAA;AACD,MAAA,GAAA,CAAI,SAAA,EAAW;AACb,QAAA,OAAA,CAAQ,IAAA;AAAA,UACN,iCAAA,YAAW,EAAc,KAAA,CAAM,UAAU;AAAA,QAC3C,CAAA;AAAA,MACF;AAAA,IACF,EAAA,KAAO;AACL,MAAA,MAAM,IAAI,KAAA,CAAM,8CAA8C,CAAA;AAAA,IAChE;AAAA,EACF,CAAC,CAAA;AACD,EAAA,OAAO,wCAAA,OAAyB,CAAA;AAClC;AAGA,IAAO,mCAAA,EAAQ,mBAAA;ADtDf;AACE;AACA;AACF,wGAAC","file":"/home/runner/work/turf/turf/packages/turf-points-within-polygon/dist/cjs/index.cjs","sourcesContent":[null,"import type {\n Feature,\n FeatureCollection,\n Polygon,\n MultiPolygon,\n MultiPoint,\n Point,\n GeoJsonProperties,\n Position,\n} from \"geojson\";\nimport { booleanPointInPolygon as pointInPolygon } from \"@turf/boolean-point-in-polygon\";\nimport { featureCollection, multiPoint } from \"@turf/helpers\";\nimport { geomEach, featureEach, coordEach } from \"@turf/meta\";\n\n/**\n * Finds {@link Points} or {@link MultiPoint} coordinate positions that fall within {@link (Multi)Polygon(s)}.\n *\n * @function\n * @param {Feature|FeatureCollection<Point|MultiPoint>} points Point(s) or MultiPoint(s) as input search\n * @param {FeatureCollection|Geometry|Feature<Polygon|MultiPolygon>} polygons (Multi)Polygon(s) to check if points are within\n * @returns {FeatureCollection<Point|MultiPoint>} Point(s) or MultiPoint(s) with positions that land within at least one polygon. The geometry type will match what was passsed in\n * @example\n * var points = turf.points([\n * [-46.6318, -23.5523],\n * [-46.6246, -23.5325],\n * [-46.6062, -23.5513],\n * [-46.663, -23.554],\n * [-46.643, -23.557]\n * ]);\n *\n * var searchWithin = turf.polygon([[\n * [-46.653,-23.543],\n * [-46.634,-23.5346],\n * [-46.613,-23.543],\n * [-46.614,-23.559],\n * [-46.631,-23.567],\n * [-46.653,-23.560],\n * [-46.653,-23.543]\n * ]]);\n *\n * var ptsWithin = turf.pointsWithinPolygon(points, searchWithin);\n *\n * //addToMap\n * var addToMap = [points, searchWithin, ptsWithin]\n * turf.featureEach(ptsWithin, function (currentFeature) {\n * currentFeature.properties['marker-size'] = 'large';\n * currentFeature.properties['marker-color'] = '#000';\n * });\n */\nfunction pointsWithinPolygon<\n G extends Polygon | MultiPolygon,\n P extends GeoJsonProperties,\n>(\n points:\n | Feature<Point | MultiPoint, P>\n | FeatureCollection<Point | MultiPoint, P>,\n polygons: Feature<G> | FeatureCollection<G> | G\n): FeatureCollection<Point | MultiPoint, P> {\n const results: Feature<Point | MultiPoint, P>[] = [];\n featureEach(points, function (point) {\n let contained = false;\n if (point.geometry.type === \"Point\") {\n geomEach(polygons, function (polygon) {\n if (pointInPolygon(point as Feature<Point, P>, polygon)) {\n contained = true;\n }\n });\n if (contained) {\n results.push(point);\n }\n } else if (point.geometry.type === \"MultiPoint\") {\n var pointsWithin: Position[] = [];\n geomEach(polygons, function (polygon) {\n coordEach(point as Feature<MultiPoint>, function (pointCoord) {\n if (pointInPolygon(pointCoord, polygon)) {\n contained = true;\n pointsWithin.push(pointCoord);\n }\n });\n });\n if (contained) {\n results.push(\n multiPoint(pointsWithin, point.properties) as Feature<MultiPoint, P>\n );\n }\n } else {\n throw new Error(\"Input geometry must be a Point or MultiPoint\");\n }\n });\n return featureCollection(results);\n}\n\nexport { pointsWithinPolygon };\nexport default pointsWithinPolygon;\n"]}
|
package/dist/cjs/index.d.cts
CHANGED
|
@@ -3,7 +3,7 @@ import { Polygon, MultiPolygon, GeoJsonProperties, Feature, Point, MultiPoint, F
|
|
|
3
3
|
/**
|
|
4
4
|
* Finds {@link Points} or {@link MultiPoint} coordinate positions that fall within {@link (Multi)Polygon(s)}.
|
|
5
5
|
*
|
|
6
|
-
* @
|
|
6
|
+
* @function
|
|
7
7
|
* @param {Feature|FeatureCollection<Point|MultiPoint>} points Point(s) or MultiPoint(s) as input search
|
|
8
8
|
* @param {FeatureCollection|Geometry|Feature<Polygon|MultiPolygon>} polygons (Multi)Polygon(s) to check if points are within
|
|
9
9
|
* @returns {FeatureCollection<Point|MultiPoint>} Point(s) or MultiPoint(s) with positions that land within at least one polygon. The geometry type will match what was passsed in
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { Polygon, MultiPolygon, GeoJsonProperties, Feature, Point, MultiPoint, F
|
|
|
3
3
|
/**
|
|
4
4
|
* Finds {@link Points} or {@link MultiPoint} coordinate positions that fall within {@link (Multi)Polygon(s)}.
|
|
5
5
|
*
|
|
6
|
-
* @
|
|
6
|
+
* @function
|
|
7
7
|
* @param {Feature|FeatureCollection<Point|MultiPoint>} points Point(s) or MultiPoint(s) as input search
|
|
8
8
|
* @param {FeatureCollection|Geometry|Feature<Polygon|MultiPolygon>} polygons (Multi)Polygon(s) to check if points are within
|
|
9
9
|
* @returns {FeatureCollection<Point|MultiPoint>} Point(s) or MultiPoint(s) with positions that land within at least one polygon. The geometry type will match what was passsed in
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../index.ts"],"sourcesContent":["import type {\n Feature,\n FeatureCollection,\n Polygon,\n MultiPolygon,\n MultiPoint,\n Point,\n GeoJsonProperties,\n Position,\n} from \"geojson\";\nimport { booleanPointInPolygon as pointInPolygon } from \"@turf/boolean-point-in-polygon\";\nimport { featureCollection, multiPoint } from \"@turf/helpers\";\nimport { geomEach, featureEach, coordEach } from \"@turf/meta\";\n\n/**\n * Finds {@link Points} or {@link MultiPoint} coordinate positions that fall within {@link (Multi)Polygon(s)}.\n *\n * @
|
|
1
|
+
{"version":3,"sources":["../../index.ts"],"sourcesContent":["import type {\n Feature,\n FeatureCollection,\n Polygon,\n MultiPolygon,\n MultiPoint,\n Point,\n GeoJsonProperties,\n Position,\n} from \"geojson\";\nimport { booleanPointInPolygon as pointInPolygon } from \"@turf/boolean-point-in-polygon\";\nimport { featureCollection, multiPoint } from \"@turf/helpers\";\nimport { geomEach, featureEach, coordEach } from \"@turf/meta\";\n\n/**\n * Finds {@link Points} or {@link MultiPoint} coordinate positions that fall within {@link (Multi)Polygon(s)}.\n *\n * @function\n * @param {Feature|FeatureCollection<Point|MultiPoint>} points Point(s) or MultiPoint(s) as input search\n * @param {FeatureCollection|Geometry|Feature<Polygon|MultiPolygon>} polygons (Multi)Polygon(s) to check if points are within\n * @returns {FeatureCollection<Point|MultiPoint>} Point(s) or MultiPoint(s) with positions that land within at least one polygon. The geometry type will match what was passsed in\n * @example\n * var points = turf.points([\n * [-46.6318, -23.5523],\n * [-46.6246, -23.5325],\n * [-46.6062, -23.5513],\n * [-46.663, -23.554],\n * [-46.643, -23.557]\n * ]);\n *\n * var searchWithin = turf.polygon([[\n * [-46.653,-23.543],\n * [-46.634,-23.5346],\n * [-46.613,-23.543],\n * [-46.614,-23.559],\n * [-46.631,-23.567],\n * [-46.653,-23.560],\n * [-46.653,-23.543]\n * ]]);\n *\n * var ptsWithin = turf.pointsWithinPolygon(points, searchWithin);\n *\n * //addToMap\n * var addToMap = [points, searchWithin, ptsWithin]\n * turf.featureEach(ptsWithin, function (currentFeature) {\n * currentFeature.properties['marker-size'] = 'large';\n * currentFeature.properties['marker-color'] = '#000';\n * });\n */\nfunction pointsWithinPolygon<\n G extends Polygon | MultiPolygon,\n P extends GeoJsonProperties,\n>(\n points:\n | Feature<Point | MultiPoint, P>\n | FeatureCollection<Point | MultiPoint, P>,\n polygons: Feature<G> | FeatureCollection<G> | G\n): FeatureCollection<Point | MultiPoint, P> {\n const results: Feature<Point | MultiPoint, P>[] = [];\n featureEach(points, function (point) {\n let contained = false;\n if (point.geometry.type === \"Point\") {\n geomEach(polygons, function (polygon) {\n if (pointInPolygon(point as Feature<Point, P>, polygon)) {\n contained = true;\n }\n });\n if (contained) {\n results.push(point);\n }\n } else if (point.geometry.type === \"MultiPoint\") {\n var pointsWithin: Position[] = [];\n geomEach(polygons, function (polygon) {\n coordEach(point as Feature<MultiPoint>, function (pointCoord) {\n if (pointInPolygon(pointCoord, polygon)) {\n contained = true;\n pointsWithin.push(pointCoord);\n }\n });\n });\n if (contained) {\n results.push(\n multiPoint(pointsWithin, point.properties) as Feature<MultiPoint, P>\n );\n }\n } else {\n throw new Error(\"Input geometry must be a Point or MultiPoint\");\n }\n });\n return featureCollection(results);\n}\n\nexport { pointsWithinPolygon };\nexport default pointsWithinPolygon;\n"],"mappings":";AAUA,SAAS,yBAAyB,sBAAsB;AACxD,SAAS,mBAAmB,kBAAkB;AAC9C,SAAS,UAAU,aAAa,iBAAiB;AAqCjD,SAAS,oBAIP,QAGA,UAC0C;AAC1C,QAAM,UAA4C,CAAC;AACnD,cAAY,QAAQ,SAAU,OAAO;AACnC,QAAI,YAAY;AAChB,QAAI,MAAM,SAAS,SAAS,SAAS;AACnC,eAAS,UAAU,SAAU,SAAS;AACpC,YAAI,eAAe,OAA4B,OAAO,GAAG;AACvD,sBAAY;AAAA,QACd;AAAA,MACF,CAAC;AACD,UAAI,WAAW;AACb,gBAAQ,KAAK,KAAK;AAAA,MACpB;AAAA,IACF,WAAW,MAAM,SAAS,SAAS,cAAc;AAC/C,UAAI,eAA2B,CAAC;AAChC,eAAS,UAAU,SAAU,SAAS;AACpC,kBAAU,OAA8B,SAAU,YAAY;AAC5D,cAAI,eAAe,YAAY,OAAO,GAAG;AACvC,wBAAY;AACZ,yBAAa,KAAK,UAAU;AAAA,UAC9B;AAAA,QACF,CAAC;AAAA,MACH,CAAC;AACD,UAAI,WAAW;AACb,gBAAQ;AAAA,UACN,WAAW,cAAc,MAAM,UAAU;AAAA,QAC3C;AAAA,MACF;AAAA,IACF,OAAO;AACL,YAAM,IAAI,MAAM,8CAA8C;AAAA,IAChE;AAAA,EACF,CAAC;AACD,SAAO,kBAAkB,OAAO;AAClC;AAGA,IAAO,qCAAQ;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@turf/points-within-polygon",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.2.0",
|
|
4
4
|
"description": "turf points-within-polygon module",
|
|
5
5
|
"author": "Turf Authors",
|
|
6
6
|
"license": "MIT",
|
|
@@ -54,20 +54,20 @@
|
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"@types/benchmark": "^2.1.5",
|
|
57
|
-
"@types/tape": "^4.
|
|
57
|
+
"@types/tape": "^4.13.4",
|
|
58
58
|
"benchmark": "^2.1.4",
|
|
59
59
|
"npm-run-all": "^4.1.5",
|
|
60
|
-
"tape": "^5.
|
|
61
|
-
"tsup": "^8.
|
|
62
|
-
"tsx": "^4.
|
|
63
|
-
"typescript": "^5.
|
|
60
|
+
"tape": "^5.9.0",
|
|
61
|
+
"tsup": "^8.3.5",
|
|
62
|
+
"tsx": "^4.19.2",
|
|
63
|
+
"typescript": "^5.5.4"
|
|
64
64
|
},
|
|
65
65
|
"dependencies": {
|
|
66
|
-
"@turf/boolean-point-in-polygon": "^7.
|
|
67
|
-
"@turf/helpers": "^7.
|
|
68
|
-
"@turf/meta": "^7.
|
|
66
|
+
"@turf/boolean-point-in-polygon": "^7.2.0",
|
|
67
|
+
"@turf/helpers": "^7.2.0",
|
|
68
|
+
"@turf/meta": "^7.2.0",
|
|
69
69
|
"@types/geojson": "^7946.0.10",
|
|
70
|
-
"tslib": "^2.
|
|
70
|
+
"tslib": "^2.8.1"
|
|
71
71
|
},
|
|
72
|
-
"gitHead": "
|
|
72
|
+
"gitHead": "7b0f0374c4668cd569f8904c71e2ae7d941be867"
|
|
73
73
|
}
|