@turf/geojson-rbush 7.3.1 → 7.3.3
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 +166 -47
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.cts +130 -18
- package/dist/esm/index.d.ts +130 -18
- package/dist/esm/index.js +166 -47
- package/dist/esm/index.js.map +1 -1
- package/package.json +10 -8
package/dist/cjs/index.cjs
CHANGED
|
@@ -1,16 +1,59 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }// index.
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }// index.ts
|
|
2
2
|
var _rbush = require('rbush'); var _rbush2 = _interopRequireDefault(_rbush);
|
|
3
3
|
var _helpers = require('@turf/helpers');
|
|
4
4
|
var _meta = require('@turf/meta');
|
|
5
5
|
var _bbox = require('@turf/bbox');
|
|
6
|
-
function
|
|
7
|
-
var
|
|
8
|
-
|
|
6
|
+
function toBBox(geojson) {
|
|
7
|
+
var bbox;
|
|
8
|
+
if (geojson.bbox) bbox = geojson.bbox;
|
|
9
|
+
else if (Array.isArray(geojson) && geojson.length === 4) bbox = geojson;
|
|
10
|
+
else if (Array.isArray(geojson) && geojson.length === 6)
|
|
11
|
+
bbox = [geojson[0], geojson[1], geojson[3], geojson[4]];
|
|
12
|
+
else if (geojson.type === "Feature") bbox = _bbox.bbox.call(void 0, geojson);
|
|
13
|
+
else if (geojson.type === "FeatureCollection") bbox = _bbox.bbox.call(void 0, geojson);
|
|
14
|
+
else throw new Error("invalid geojson");
|
|
15
|
+
return {
|
|
16
|
+
minX: bbox[0],
|
|
17
|
+
minY: bbox[1],
|
|
18
|
+
maxX: bbox[2],
|
|
19
|
+
maxY: bbox[3]
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
var RBush = class {
|
|
23
|
+
constructor(maxEntries = 9) {
|
|
24
|
+
this.tree = new (0, _rbush2.default)(maxEntries);
|
|
25
|
+
this.tree.toBBox = toBBox;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* [insert](https://github.com/mourner/rbush#data-format)
|
|
29
|
+
*
|
|
30
|
+
* @memberof rbush
|
|
31
|
+
* @param {Feature} feature insert single GeoJSON Feature
|
|
32
|
+
* @returns {RBush} GeoJSON RBush
|
|
33
|
+
* @example
|
|
34
|
+
* var poly = turf.polygon([[[-78, 41], [-67, 41], [-67, 48], [-78, 48], [-78, 41]]]);
|
|
35
|
+
* tree.insert(poly)
|
|
36
|
+
*/
|
|
37
|
+
insert(feature) {
|
|
9
38
|
if (feature.type !== "Feature") throw new Error("invalid feature");
|
|
10
39
|
feature.bbox = feature.bbox ? feature.bbox : _bbox.bbox.call(void 0, feature);
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
40
|
+
this.tree.insert(feature);
|
|
41
|
+
return this;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* [load](https://github.com/mourner/rbush#bulk-inserting-data)
|
|
45
|
+
*
|
|
46
|
+
* @memberof rbush
|
|
47
|
+
* @param {FeatureCollection|Array<Feature>} features load entire GeoJSON FeatureCollection
|
|
48
|
+
* @returns {RBush} GeoJSON RBush
|
|
49
|
+
* @example
|
|
50
|
+
* var polys = turf.polygons([
|
|
51
|
+
* [[[-78, 41], [-67, 41], [-67, 48], [-78, 48], [-78, 41]]],
|
|
52
|
+
* [[[-93, 32], [-83, 32], [-83, 39], [-93, 39], [-93, 32]]]
|
|
53
|
+
* ]);
|
|
54
|
+
* tree.load(polys);
|
|
55
|
+
*/
|
|
56
|
+
load(features) {
|
|
14
57
|
var load = [];
|
|
15
58
|
if (Array.isArray(features)) {
|
|
16
59
|
features.forEach(function(feature) {
|
|
@@ -25,50 +68,126 @@ function geojsonRbush(maxEntries) {
|
|
|
25
68
|
load.push(feature);
|
|
26
69
|
});
|
|
27
70
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
71
|
+
this.tree.load(load);
|
|
72
|
+
return this;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* [remove](https://github.com/mourner/rbush#removing-data)
|
|
76
|
+
*
|
|
77
|
+
* @memberof rbush
|
|
78
|
+
* @param {Feature} feature remove single GeoJSON Feature
|
|
79
|
+
* @param {Function} equals Pass a custom equals function to compare by value for removal.
|
|
80
|
+
* @returns {RBush} GeoJSON RBush
|
|
81
|
+
* @example
|
|
82
|
+
* var poly = turf.polygon([[[-78, 41], [-67, 41], [-67, 48], [-78, 48], [-78, 41]]]);
|
|
83
|
+
*
|
|
84
|
+
* tree.remove(poly);
|
|
85
|
+
*/
|
|
86
|
+
remove(feature, equals) {
|
|
31
87
|
if (feature.type !== "Feature") throw new Error("invalid feature");
|
|
32
88
|
feature.bbox = feature.bbox ? feature.bbox : _bbox.bbox.call(void 0, feature);
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
89
|
+
this.tree.remove(feature, equals);
|
|
90
|
+
return this;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* [clear](https://github.com/mourner/rbush#removing-data)
|
|
94
|
+
*
|
|
95
|
+
* @memberof rbush
|
|
96
|
+
* @returns {RBush} GeoJSON Rbush
|
|
97
|
+
* @example
|
|
98
|
+
* tree.clear()
|
|
99
|
+
*/
|
|
100
|
+
clear() {
|
|
101
|
+
this.tree.clear();
|
|
102
|
+
return this;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* [search](https://github.com/mourner/rbush#search)
|
|
106
|
+
*
|
|
107
|
+
* @memberof rbush
|
|
108
|
+
* @param {BBox|FeatureCollection|Feature} geojson search with GeoJSON
|
|
109
|
+
* @returns {FeatureCollection} all features that intersects with the given GeoJSON.
|
|
110
|
+
* @example
|
|
111
|
+
* var poly = turf.polygon([[[-78, 41], [-67, 41], [-67, 48], [-78, 48], [-78, 41]]]);
|
|
112
|
+
*
|
|
113
|
+
* tree.search(poly);
|
|
114
|
+
*/
|
|
115
|
+
search(geojson) {
|
|
116
|
+
var features = this.tree.search(toBBox(geojson));
|
|
40
117
|
return _helpers.featureCollection.call(void 0, features);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* [collides](https://github.com/mourner/rbush#collisions)
|
|
121
|
+
*
|
|
122
|
+
* @memberof rbush
|
|
123
|
+
* @param {BBox|FeatureCollection|Feature} geojson collides with GeoJSON
|
|
124
|
+
* @returns {boolean} true if there are any items intersecting the given GeoJSON, otherwise false.
|
|
125
|
+
* @example
|
|
126
|
+
* var poly = turf.polygon([[[-78, 41], [-67, 41], [-67, 48], [-78, 48], [-78, 41]]]);
|
|
127
|
+
*
|
|
128
|
+
* tree.collides(poly);
|
|
129
|
+
*/
|
|
130
|
+
collides(geojson) {
|
|
131
|
+
return this.tree.collides(toBBox(geojson));
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* [all](https://github.com/mourner/rbush#search)
|
|
135
|
+
*
|
|
136
|
+
* @memberof rbush
|
|
137
|
+
* @returns {FeatureCollection} all the features in RBush
|
|
138
|
+
* @example
|
|
139
|
+
* tree.all()
|
|
140
|
+
*/
|
|
141
|
+
all() {
|
|
142
|
+
const features = this.tree.all();
|
|
47
143
|
return _helpers.featureCollection.call(void 0, features);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* [toJSON](https://github.com/mourner/rbush#export-and-import)
|
|
147
|
+
*
|
|
148
|
+
* @memberof rbush
|
|
149
|
+
* @returns {any} export data as JSON object
|
|
150
|
+
* @example
|
|
151
|
+
* var exported = tree.toJSON()
|
|
152
|
+
*/
|
|
153
|
+
toJSON() {
|
|
154
|
+
return this.tree.toJSON();
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* [fromJSON](https://github.com/mourner/rbush#export-and-import)
|
|
158
|
+
*
|
|
159
|
+
* @memberof rbush
|
|
160
|
+
* @param {any} json import previously exported data
|
|
161
|
+
* @returns {RBush} GeoJSON RBush
|
|
162
|
+
* @example
|
|
163
|
+
* var exported = {
|
|
164
|
+
* "children": [
|
|
165
|
+
* {
|
|
166
|
+
* "type": "Feature",
|
|
167
|
+
* "geometry": {
|
|
168
|
+
* "type": "Point",
|
|
169
|
+
* "coordinates": [110, 50]
|
|
170
|
+
* },
|
|
171
|
+
* "properties": {},
|
|
172
|
+
* "bbox": [110, 50, 110, 50]
|
|
173
|
+
* }
|
|
174
|
+
* ],
|
|
175
|
+
* "height": 1,
|
|
176
|
+
* "leaf": true,
|
|
177
|
+
* "minX": 110,
|
|
178
|
+
* "minY": 50,
|
|
179
|
+
* "maxX": 110,
|
|
180
|
+
* "maxY": 50
|
|
181
|
+
* }
|
|
182
|
+
* tree.fromJSON(exported)
|
|
183
|
+
*/
|
|
184
|
+
fromJSON(json) {
|
|
185
|
+
this.tree.fromJSON(json);
|
|
186
|
+
return this;
|
|
187
|
+
}
|
|
188
|
+
};
|
|
189
|
+
function geojsonRbush(maxEntries) {
|
|
190
|
+
return new RBush(maxEntries);
|
|
72
191
|
}
|
|
73
192
|
var index_default = geojsonRbush;
|
|
74
193
|
|
package/dist/cjs/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
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AAC,CAAC,CAAA;AAAA,IAAA,KAAA,GAAA,CAC/C,OAAA,CAAQ,KAAA,IAAS,SAAA,EAAW,KAAA,EAAO,wBAAA,OAAgB,CAAA;AAAA,IAAA,KAAA,GAAA,CACnD,OAAA,CAAQ,KAAA,IAAS,mBAAA,EAAqB,KAAA,EAAO,wBAAA,OAAgB,CAAA;AAAA,IAAA,KACjE,MAAM,IAAI,KAAA,CAAM,iBAAiB,CAAA;AAEtC,IAAA,OAAO;AAAA,MACL,IAAA,EAAM,IAAA,CAAK,CAAC,CAAA;AAAA,MACZ,IAAA,EAAM,IAAA,CAAK,CAAC,CAAA;AAAA,MACZ,IAAA,EAAM,IAAA,CAAK,CAAC,CAAA;AAAA,MACZ,IAAA,EAAM,IAAA,CAAK,CAAC;AAAA,IACd,CAAA;AAAA,EACF,CAAA;AACA,EAAA,OAAO,IAAA;AACT;AAGA,IAAO,cAAA,EAAQ,YAAA;ADlJf;AACE;AACA;AACF,qEAAC","file":"/home/runner/work/turf/turf/packages/turf-geojson-rbush/dist/cjs/index.cjs","sourcesContent":[null,"import rbush from \"rbush\";\nimport { featureCollection } from \"@turf/helpers\";\nimport { featureEach } from \"@turf/meta\";\nimport { bbox as turfBBox } from \"@turf/bbox\";\n\n/**\n * @module rbush\n */\n\n/**\n * GeoJSON implementation of [RBush](https://github.com/mourner/rbush#rbush) spatial index.\n *\n * @function rbush\n * @param {number} [maxEntries=9] defines the maximum number of entries in a tree node. 9 (used by default) is a\n * reasonable choice for most applications. Higher value means faster insertion and slower search, and vice versa.\n * @returns {RBush} GeoJSON RBush\n * @example\n * var geojsonRbush = require('geojson-rbush').default;\n * var tree = geojsonRbush();\n */\nfunction geojsonRbush(maxEntries) {\n var tree = new rbush(maxEntries);\n\n /**\n * [insert](https://github.com/mourner/rbush#data-format)\n *\n * @memberof rbush\n * @param {Feature} feature insert single GeoJSON Feature\n * @returns {RBush} GeoJSON RBush\n * @example\n * var poly = turf.polygon([[[-78, 41], [-67, 41], [-67, 48], [-78, 48], [-78, 41]]]);\n * tree.insert(poly)\n */\n tree.insert = function (feature) {\n if (feature.type !== \"Feature\") throw new Error(\"invalid feature\");\n feature.bbox = feature.bbox ? feature.bbox : turfBBox(feature);\n return rbush.prototype.insert.call(this, feature);\n };\n\n /**\n * [load](https://github.com/mourner/rbush#bulk-inserting-data)\n *\n * @memberof rbush\n * @param {FeatureCollection|Array<Feature>} features load entire GeoJSON FeatureCollection\n * @returns {RBush} GeoJSON RBush\n * @example\n * var polys = turf.polygons([\n * [[[-78, 41], [-67, 41], [-67, 48], [-78, 48], [-78, 41]]],\n * [[[-93, 32], [-83, 32], [-83, 39], [-93, 39], [-93, 32]]]\n * ]);\n * tree.load(polys);\n */\n tree.load = function (features) {\n var load = [];\n // Load an Array of Features\n if (Array.isArray(features)) {\n features.forEach(function (feature) {\n if (feature.type !== \"Feature\") throw new Error(\"invalid features\");\n feature.bbox = feature.bbox ? feature.bbox : turfBBox(feature);\n load.push(feature);\n });\n } else {\n // Load a FeatureCollection\n featureEach(features, function (feature) {\n if (feature.type !== \"Feature\") throw new Error(\"invalid features\");\n feature.bbox = feature.bbox ? feature.bbox : turfBBox(feature);\n load.push(feature);\n });\n }\n return rbush.prototype.load.call(this, load);\n };\n\n /**\n * [remove](https://github.com/mourner/rbush#removing-data)\n *\n * @memberof rbush\n * @param {Feature} feature remove single GeoJSON Feature\n * @param {Function} equals Pass a custom equals function to compare by value for removal.\n * @returns {RBush} GeoJSON RBush\n * @example\n * var poly = turf.polygon([[[-78, 41], [-67, 41], [-67, 48], [-78, 48], [-78, 41]]]);\n *\n * tree.remove(poly);\n */\n tree.remove = function (feature, equals) {\n if (feature.type !== \"Feature\") throw new Error(\"invalid feature\");\n feature.bbox = feature.bbox ? feature.bbox : turfBBox(feature);\n return rbush.prototype.remove.call(this, feature, equals);\n };\n\n /**\n * [clear](https://github.com/mourner/rbush#removing-data)\n *\n * @memberof rbush\n * @returns {RBush} GeoJSON Rbush\n * @example\n * tree.clear()\n */\n tree.clear = function () {\n return rbush.prototype.clear.call(this);\n };\n\n /**\n * [search](https://github.com/mourner/rbush#search)\n *\n * @memberof rbush\n * @param {BBox|FeatureCollection|Feature} geojson search with GeoJSON\n * @returns {FeatureCollection} all features that intersects with the given GeoJSON.\n * @example\n * var poly = turf.polygon([[[-78, 41], [-67, 41], [-67, 48], [-78, 48], [-78, 41]]]);\n *\n * tree.search(poly);\n */\n tree.search = function (geojson) {\n var features = rbush.prototype.search.call(this, this.toBBox(geojson));\n return featureCollection(features);\n };\n\n /**\n * [collides](https://github.com/mourner/rbush#collisions)\n *\n * @memberof rbush\n * @param {BBox|FeatureCollection|Feature} geojson collides with GeoJSON\n * @returns {boolean} true if there are any items intersecting the given GeoJSON, otherwise false.\n * @example\n * var poly = turf.polygon([[[-78, 41], [-67, 41], [-67, 48], [-78, 48], [-78, 41]]]);\n *\n * tree.collides(poly);\n */\n tree.collides = function (geojson) {\n return rbush.prototype.collides.call(this, this.toBBox(geojson));\n };\n\n /**\n * [all](https://github.com/mourner/rbush#search)\n *\n * @memberof rbush\n * @returns {FeatureCollection} all the features in RBush\n * @example\n * tree.all()\n */\n tree.all = function () {\n var features = rbush.prototype.all.call(this);\n return featureCollection(features);\n };\n\n /**\n * [toJSON](https://github.com/mourner/rbush#export-and-import)\n *\n * @memberof rbush\n * @returns {any} export data as JSON object\n * @example\n * var exported = tree.toJSON()\n */\n tree.toJSON = function () {\n return rbush.prototype.toJSON.call(this);\n };\n\n /**\n * [fromJSON](https://github.com/mourner/rbush#export-and-import)\n *\n * @memberof rbush\n * @param {any} json import previously exported data\n * @returns {RBush} GeoJSON RBush\n * @example\n * var exported = {\n * \"children\": [\n * {\n * \"type\": \"Feature\",\n * \"geometry\": {\n * \"type\": \"Point\",\n * \"coordinates\": [110, 50]\n * },\n * \"properties\": {},\n * \"bbox\": [110, 50, 110, 50]\n * }\n * ],\n * \"height\": 1,\n * \"leaf\": true,\n * \"minX\": 110,\n * \"minY\": 50,\n * \"maxX\": 110,\n * \"maxY\": 50\n * }\n * tree.fromJSON(exported)\n */\n tree.fromJSON = function (json) {\n return rbush.prototype.fromJSON.call(this, json);\n };\n\n /**\n * Converts GeoJSON to {minX, minY, maxX, maxY} schema\n *\n * @memberof rbush\n * @private\n * @param {BBox|FeatureCollection|Feature} geojson feature(s) to retrieve BBox from\n * @returns {Object} converted to {minX, minY, maxX, maxY}\n */\n tree.toBBox = function (geojson) {\n var bbox;\n if (geojson.bbox) bbox = geojson.bbox;\n else if (Array.isArray(geojson) && geojson.length === 4) bbox = geojson;\n else if (Array.isArray(geojson) && geojson.length === 6)\n bbox = [geojson[0], geojson[1], geojson[3], geojson[4]];\n else if (geojson.type === \"Feature\") bbox = turfBBox(geojson);\n else if (geojson.type === \"FeatureCollection\") bbox = turfBBox(geojson);\n else throw new Error(\"invalid geojson\");\n\n return {\n minX: bbox[0],\n minY: bbox[1],\n maxX: bbox[2],\n maxY: bbox[3],\n };\n };\n return tree;\n}\n\nexport { geojsonRbush };\nexport default geojsonRbush;\n"]}
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/turf/turf/packages/turf-geojson-rbush/dist/cjs/index.cjs","../../index.ts"],"names":[],"mappings":"AAAA;ACAA,4EAAkB;AAClB,wCAAkC;AAClC,kCAA4B;AAC5B,kCAAiC;AAqBjC,SAAS,MAAA,CAAO,OAAA,EAA6C;AAC3D,EAAA,IAAI,IAAA;AACJ,EAAA,GAAA,CAAK,OAAA,CAAgB,IAAA,EAAM,KAAA,EAAQ,OAAA,CAAgB,IAAA;AAAA,EAAA,KAAA,GAAA,CAC1C,KAAA,CAAM,OAAA,CAAQ,OAAO,EAAA,GAAK,OAAA,CAAQ,OAAA,IAAW,CAAA,EAAG,KAAA,EAAO,OAAA;AAAA,EAAA,KAAA,GAAA,CACvD,KAAA,CAAM,OAAA,CAAQ,OAAO,EAAA,GAAK,OAAA,CAAQ,OAAA,IAAW,CAAA;AACpD,IAAA,KAAA,EAAO,CAAC,OAAA,CAAQ,CAAC,CAAA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AA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EA8BA,QAAA,CAAS,IAAA,EAAwB;AAC/B,IAAA,IAAA,CAAK,IAAA,CAAK,QAAA,CAAS,IAAI,CAAA;AACvB,IAAA,OAAO,IAAA;AAAA,EACT;AACF,CAAA;AAaA,SAAS,YAAA,CAGP,UAAA,EAAqB;AACrB,EAAA,OAAO,IAAI,KAAA,CAAY,UAAU,CAAA;AACnC;AAGA,IAAO,cAAA,EAAQ,YAAA;ADxDf;AACE;AACA;AACF,qEAAC","file":"/home/runner/work/turf/turf/packages/turf-geojson-rbush/dist/cjs/index.cjs","sourcesContent":[null,"import rbush from \"rbush\";\nimport { featureCollection } from \"@turf/helpers\";\nimport { featureEach } from \"@turf/meta\";\nimport { bbox as turfBBox } from \"@turf/bbox\";\nimport {\n BBox,\n Feature,\n FeatureCollection,\n GeoJsonProperties,\n Geometry,\n} from \"geojson\";\n\n/**\n * @module rbush\n */\n\n/**\n * Converts GeoJSON to {minX, minY, maxX, maxY} schema\n *\n * @memberof rbush\n * @private\n * @param {BBox|FeatureCollection|Feature} geojson feature(s) to retrieve BBox from\n * @returns {Object} converted to {minX, minY, maxX, maxY}\n */\nfunction toBBox(geojson: BBox | FeatureCollection | Feature) {\n var bbox;\n if ((geojson as any).bbox) bbox = (geojson as any).bbox;\n else if (Array.isArray(geojson) && geojson.length === 4) bbox = geojson;\n else if (Array.isArray(geojson) && geojson.length === 6)\n bbox = [geojson[0], geojson[1], geojson[3], geojson[4]];\n else if (geojson.type === \"Feature\") bbox = turfBBox(geojson);\n else if (geojson.type === \"FeatureCollection\") bbox = turfBBox(geojson);\n else throw new Error(\"invalid geojson\");\n\n return {\n minX: bbox[0],\n minY: bbox[1],\n maxX: bbox[2],\n maxY: bbox[3],\n };\n}\n\nclass RBush<G extends Geometry, P extends GeoJsonProperties> {\n private tree: rbush<Feature<G, P>>;\n\n constructor(maxEntries = 9) {\n this.tree = new rbush<Feature<G, P>>(maxEntries);\n // When we load features into the underlying rbush instance, it has to be able to correctly\n // handle GeoJSON bbox values while inserting into the data structure. The rest of the API\n // can just be a passthrough wrapping class.\n this.tree.toBBox = toBBox;\n }\n\n /**\n * [insert](https://github.com/mourner/rbush#data-format)\n *\n * @memberof rbush\n * @param {Feature} feature insert single GeoJSON Feature\n * @returns {RBush} GeoJSON RBush\n * @example\n * var poly = turf.polygon([[[-78, 41], [-67, 41], [-67, 48], [-78, 48], [-78, 41]]]);\n * tree.insert(poly)\n */\n insert(feature: Feature<G, P>): RBush<G, P> {\n if (feature.type !== \"Feature\") throw new Error(\"invalid feature\");\n feature.bbox = feature.bbox ? feature.bbox : turfBBox(feature);\n this.tree.insert(feature);\n return this;\n }\n\n /**\n * [load](https://github.com/mourner/rbush#bulk-inserting-data)\n *\n * @memberof rbush\n * @param {FeatureCollection|Array<Feature>} features load entire GeoJSON FeatureCollection\n * @returns {RBush} GeoJSON RBush\n * @example\n * var polys = turf.polygons([\n * [[[-78, 41], [-67, 41], [-67, 48], [-78, 48], [-78, 41]]],\n * [[[-93, 32], [-83, 32], [-83, 39], [-93, 39], [-93, 32]]]\n * ]);\n * tree.load(polys);\n */\n load(features: FeatureCollection<G, P> | Feature<G, P>[]): RBush<G, P> {\n var load: Feature<G, P>[] = [];\n // Load an Array of Features\n if (Array.isArray(features)) {\n features.forEach(function (feature) {\n if (feature.type !== \"Feature\") throw new Error(\"invalid features\");\n feature.bbox = feature.bbox ? feature.bbox : turfBBox(feature);\n load.push(feature);\n });\n } else {\n // Load a FeatureCollection\n featureEach(features, function (feature) {\n if (feature.type !== \"Feature\") throw new Error(\"invalid features\");\n feature.bbox = feature.bbox ? feature.bbox : turfBBox(feature);\n load.push(feature);\n });\n }\n this.tree.load(load);\n return this;\n }\n\n /**\n * [remove](https://github.com/mourner/rbush#removing-data)\n *\n * @memberof rbush\n * @param {Feature} feature remove single GeoJSON Feature\n * @param {Function} equals Pass a custom equals function to compare by value for removal.\n * @returns {RBush} GeoJSON RBush\n * @example\n * var poly = turf.polygon([[[-78, 41], [-67, 41], [-67, 48], [-78, 48], [-78, 41]]]);\n *\n * tree.remove(poly);\n */\n remove(\n feature: Feature<G, P>,\n equals?: (a: Feature<G, P>, b: Feature<G, P>) => boolean\n ) {\n if (feature.type !== \"Feature\") throw new Error(\"invalid feature\");\n feature.bbox = feature.bbox ? feature.bbox : turfBBox(feature);\n this.tree.remove(feature, equals);\n return this;\n }\n\n /**\n * [clear](https://github.com/mourner/rbush#removing-data)\n *\n * @memberof rbush\n * @returns {RBush} GeoJSON Rbush\n * @example\n * tree.clear()\n */\n clear() {\n this.tree.clear();\n return this;\n }\n\n /**\n * [search](https://github.com/mourner/rbush#search)\n *\n * @memberof rbush\n * @param {BBox|FeatureCollection|Feature} geojson search with GeoJSON\n * @returns {FeatureCollection} all features that intersects with the given GeoJSON.\n * @example\n * var poly = turf.polygon([[[-78, 41], [-67, 41], [-67, 48], [-78, 48], [-78, 41]]]);\n *\n * tree.search(poly);\n */\n search(geojson: Feature | FeatureCollection | BBox): FeatureCollection<G, P> {\n var features = this.tree.search(toBBox(geojson));\n return featureCollection(features);\n }\n\n /**\n * [collides](https://github.com/mourner/rbush#collisions)\n *\n * @memberof rbush\n * @param {BBox|FeatureCollection|Feature} geojson collides with GeoJSON\n * @returns {boolean} true if there are any items intersecting the given GeoJSON, otherwise false.\n * @example\n * var poly = turf.polygon([[[-78, 41], [-67, 41], [-67, 48], [-78, 48], [-78, 41]]]);\n *\n * tree.collides(poly);\n */\n collides(geojson: Feature | FeatureCollection | BBox): boolean {\n return this.tree.collides(toBBox(geojson));\n }\n\n /**\n * [all](https://github.com/mourner/rbush#search)\n *\n * @memberof rbush\n * @returns {FeatureCollection} all the features in RBush\n * @example\n * tree.all()\n */\n all() {\n const features = this.tree.all();\n return featureCollection(features);\n }\n\n /**\n * [toJSON](https://github.com/mourner/rbush#export-and-import)\n *\n * @memberof rbush\n * @returns {any} export data as JSON object\n * @example\n * var exported = tree.toJSON()\n */\n toJSON() {\n return this.tree.toJSON();\n }\n\n /**\n * [fromJSON](https://github.com/mourner/rbush#export-and-import)\n *\n * @memberof rbush\n * @param {any} json import previously exported data\n * @returns {RBush} GeoJSON RBush\n * @example\n * var exported = {\n * \"children\": [\n * {\n * \"type\": \"Feature\",\n * \"geometry\": {\n * \"type\": \"Point\",\n * \"coordinates\": [110, 50]\n * },\n * \"properties\": {},\n * \"bbox\": [110, 50, 110, 50]\n * }\n * ],\n * \"height\": 1,\n * \"leaf\": true,\n * \"minX\": 110,\n * \"minY\": 50,\n * \"maxX\": 110,\n * \"maxY\": 50\n * }\n * tree.fromJSON(exported)\n */\n fromJSON(json: any): RBush<G, P> {\n this.tree.fromJSON(json);\n return this;\n }\n}\n\n/**\n * GeoJSON implementation of [RBush](https://github.com/mourner/rbush#rbush) spatial index.\n *\n * @function rbush\n * @param {number} [maxEntries=9] defines the maximum number of entries in a tree node. 9 (used by default) is a\n * reasonable choice for most applications. Higher value means faster insertion and slower search, and vice versa.\n * @returns {RBush} GeoJSON RBush\n * @example\n * var geojsonRbush = require('geojson-rbush').default;\n * var tree = geojsonRbush();\n */\nfunction geojsonRbush<\n G extends Geometry,\n P extends GeoJsonProperties = GeoJsonProperties,\n>(maxEntries?: number) {\n return new RBush<G, P>(maxEntries);\n}\n\nexport { geojsonRbush };\nexport default geojsonRbush;\n"]}
|
package/dist/cjs/index.d.cts
CHANGED
|
@@ -1,26 +1,138 @@
|
|
|
1
1
|
import { Geometry, GeoJsonProperties, Feature, FeatureCollection, BBox } from 'geojson';
|
|
2
2
|
|
|
3
3
|
declare class RBush<G extends Geometry, P extends GeoJsonProperties> {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
4
|
+
private tree;
|
|
5
|
+
constructor(maxEntries?: number);
|
|
6
|
+
/**
|
|
7
|
+
* [insert](https://github.com/mourner/rbush#data-format)
|
|
8
|
+
*
|
|
9
|
+
* @memberof rbush
|
|
10
|
+
* @param {Feature} feature insert single GeoJSON Feature
|
|
11
|
+
* @returns {RBush} GeoJSON RBush
|
|
12
|
+
* @example
|
|
13
|
+
* var poly = turf.polygon([[[-78, 41], [-67, 41], [-67, 48], [-78, 48], [-78, 41]]]);
|
|
14
|
+
* tree.insert(poly)
|
|
15
|
+
*/
|
|
16
|
+
insert(feature: Feature<G, P>): RBush<G, P>;
|
|
17
|
+
/**
|
|
18
|
+
* [load](https://github.com/mourner/rbush#bulk-inserting-data)
|
|
19
|
+
*
|
|
20
|
+
* @memberof rbush
|
|
21
|
+
* @param {FeatureCollection|Array<Feature>} features load entire GeoJSON FeatureCollection
|
|
22
|
+
* @returns {RBush} GeoJSON RBush
|
|
23
|
+
* @example
|
|
24
|
+
* var polys = turf.polygons([
|
|
25
|
+
* [[[-78, 41], [-67, 41], [-67, 48], [-78, 48], [-78, 41]]],
|
|
26
|
+
* [[[-93, 32], [-83, 32], [-83, 39], [-93, 39], [-93, 32]]]
|
|
27
|
+
* ]);
|
|
28
|
+
* tree.load(polys);
|
|
29
|
+
*/
|
|
30
|
+
load(features: FeatureCollection<G, P> | Feature<G, P>[]): RBush<G, P>;
|
|
31
|
+
/**
|
|
32
|
+
* [remove](https://github.com/mourner/rbush#removing-data)
|
|
33
|
+
*
|
|
34
|
+
* @memberof rbush
|
|
35
|
+
* @param {Feature} feature remove single GeoJSON Feature
|
|
36
|
+
* @param {Function} equals Pass a custom equals function to compare by value for removal.
|
|
37
|
+
* @returns {RBush} GeoJSON RBush
|
|
38
|
+
* @example
|
|
39
|
+
* var poly = turf.polygon([[[-78, 41], [-67, 41], [-67, 48], [-78, 48], [-78, 41]]]);
|
|
40
|
+
*
|
|
41
|
+
* tree.remove(poly);
|
|
42
|
+
*/
|
|
43
|
+
remove(feature: Feature<G, P>, equals?: (a: Feature<G, P>, b: Feature<G, P>) => boolean): this;
|
|
44
|
+
/**
|
|
45
|
+
* [clear](https://github.com/mourner/rbush#removing-data)
|
|
46
|
+
*
|
|
47
|
+
* @memberof rbush
|
|
48
|
+
* @returns {RBush} GeoJSON Rbush
|
|
49
|
+
* @example
|
|
50
|
+
* tree.clear()
|
|
51
|
+
*/
|
|
52
|
+
clear(): this;
|
|
53
|
+
/**
|
|
54
|
+
* [search](https://github.com/mourner/rbush#search)
|
|
55
|
+
*
|
|
56
|
+
* @memberof rbush
|
|
57
|
+
* @param {BBox|FeatureCollection|Feature} geojson search with GeoJSON
|
|
58
|
+
* @returns {FeatureCollection} all features that intersects with the given GeoJSON.
|
|
59
|
+
* @example
|
|
60
|
+
* var poly = turf.polygon([[[-78, 41], [-67, 41], [-67, 48], [-78, 48], [-78, 41]]]);
|
|
61
|
+
*
|
|
62
|
+
* tree.search(poly);
|
|
63
|
+
*/
|
|
64
|
+
search(geojson: Feature | FeatureCollection | BBox): FeatureCollection<G, P>;
|
|
65
|
+
/**
|
|
66
|
+
* [collides](https://github.com/mourner/rbush#collisions)
|
|
67
|
+
*
|
|
68
|
+
* @memberof rbush
|
|
69
|
+
* @param {BBox|FeatureCollection|Feature} geojson collides with GeoJSON
|
|
70
|
+
* @returns {boolean} true if there are any items intersecting the given GeoJSON, otherwise false.
|
|
71
|
+
* @example
|
|
72
|
+
* var poly = turf.polygon([[[-78, 41], [-67, 41], [-67, 48], [-78, 48], [-78, 41]]]);
|
|
73
|
+
*
|
|
74
|
+
* tree.collides(poly);
|
|
75
|
+
*/
|
|
76
|
+
collides(geojson: Feature | FeatureCollection | BBox): boolean;
|
|
77
|
+
/**
|
|
78
|
+
* [all](https://github.com/mourner/rbush#search)
|
|
79
|
+
*
|
|
80
|
+
* @memberof rbush
|
|
81
|
+
* @returns {FeatureCollection} all the features in RBush
|
|
82
|
+
* @example
|
|
83
|
+
* tree.all()
|
|
84
|
+
*/
|
|
85
|
+
all(): FeatureCollection<G, P>;
|
|
86
|
+
/**
|
|
87
|
+
* [toJSON](https://github.com/mourner/rbush#export-and-import)
|
|
88
|
+
*
|
|
89
|
+
* @memberof rbush
|
|
90
|
+
* @returns {any} export data as JSON object
|
|
91
|
+
* @example
|
|
92
|
+
* var exported = tree.toJSON()
|
|
93
|
+
*/
|
|
94
|
+
toJSON(): any;
|
|
95
|
+
/**
|
|
96
|
+
* [fromJSON](https://github.com/mourner/rbush#export-and-import)
|
|
97
|
+
*
|
|
98
|
+
* @memberof rbush
|
|
99
|
+
* @param {any} json import previously exported data
|
|
100
|
+
* @returns {RBush} GeoJSON RBush
|
|
101
|
+
* @example
|
|
102
|
+
* var exported = {
|
|
103
|
+
* "children": [
|
|
104
|
+
* {
|
|
105
|
+
* "type": "Feature",
|
|
106
|
+
* "geometry": {
|
|
107
|
+
* "type": "Point",
|
|
108
|
+
* "coordinates": [110, 50]
|
|
109
|
+
* },
|
|
110
|
+
* "properties": {},
|
|
111
|
+
* "bbox": [110, 50, 110, 50]
|
|
112
|
+
* }
|
|
113
|
+
* ],
|
|
114
|
+
* "height": 1,
|
|
115
|
+
* "leaf": true,
|
|
116
|
+
* "minX": 110,
|
|
117
|
+
* "minY": 50,
|
|
118
|
+
* "maxX": 110,
|
|
119
|
+
* "maxY": 50
|
|
120
|
+
* }
|
|
121
|
+
* tree.fromJSON(exported)
|
|
122
|
+
*/
|
|
123
|
+
fromJSON(json: any): RBush<G, P>;
|
|
16
124
|
}
|
|
17
|
-
|
|
18
125
|
/**
|
|
19
|
-
* https://github.com/mourner/rbush
|
|
126
|
+
* GeoJSON implementation of [RBush](https://github.com/mourner/rbush#rbush) spatial index.
|
|
127
|
+
*
|
|
128
|
+
* @function rbush
|
|
129
|
+
* @param {number} [maxEntries=9] defines the maximum number of entries in a tree node. 9 (used by default) is a
|
|
130
|
+
* reasonable choice for most applications. Higher value means faster insertion and slower search, and vice versa.
|
|
131
|
+
* @returns {RBush} GeoJSON RBush
|
|
132
|
+
* @example
|
|
133
|
+
* var geojsonRbush = require('geojson-rbush').default;
|
|
134
|
+
* var tree = geojsonRbush();
|
|
20
135
|
*/
|
|
21
|
-
declare function geojsonRbush<
|
|
22
|
-
G extends Geometry = Geometry,
|
|
23
|
-
P extends GeoJsonProperties = GeoJsonProperties,
|
|
24
|
-
>(maxEntries?: number): RBush<G, P>;
|
|
136
|
+
declare function geojsonRbush<G extends Geometry, P extends GeoJsonProperties = GeoJsonProperties>(maxEntries?: number): RBush<G, P>;
|
|
25
137
|
|
|
26
138
|
export { geojsonRbush as default, geojsonRbush };
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -1,26 +1,138 @@
|
|
|
1
1
|
import { Geometry, GeoJsonProperties, Feature, FeatureCollection, BBox } from 'geojson';
|
|
2
2
|
|
|
3
3
|
declare class RBush<G extends Geometry, P extends GeoJsonProperties> {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
4
|
+
private tree;
|
|
5
|
+
constructor(maxEntries?: number);
|
|
6
|
+
/**
|
|
7
|
+
* [insert](https://github.com/mourner/rbush#data-format)
|
|
8
|
+
*
|
|
9
|
+
* @memberof rbush
|
|
10
|
+
* @param {Feature} feature insert single GeoJSON Feature
|
|
11
|
+
* @returns {RBush} GeoJSON RBush
|
|
12
|
+
* @example
|
|
13
|
+
* var poly = turf.polygon([[[-78, 41], [-67, 41], [-67, 48], [-78, 48], [-78, 41]]]);
|
|
14
|
+
* tree.insert(poly)
|
|
15
|
+
*/
|
|
16
|
+
insert(feature: Feature<G, P>): RBush<G, P>;
|
|
17
|
+
/**
|
|
18
|
+
* [load](https://github.com/mourner/rbush#bulk-inserting-data)
|
|
19
|
+
*
|
|
20
|
+
* @memberof rbush
|
|
21
|
+
* @param {FeatureCollection|Array<Feature>} features load entire GeoJSON FeatureCollection
|
|
22
|
+
* @returns {RBush} GeoJSON RBush
|
|
23
|
+
* @example
|
|
24
|
+
* var polys = turf.polygons([
|
|
25
|
+
* [[[-78, 41], [-67, 41], [-67, 48], [-78, 48], [-78, 41]]],
|
|
26
|
+
* [[[-93, 32], [-83, 32], [-83, 39], [-93, 39], [-93, 32]]]
|
|
27
|
+
* ]);
|
|
28
|
+
* tree.load(polys);
|
|
29
|
+
*/
|
|
30
|
+
load(features: FeatureCollection<G, P> | Feature<G, P>[]): RBush<G, P>;
|
|
31
|
+
/**
|
|
32
|
+
* [remove](https://github.com/mourner/rbush#removing-data)
|
|
33
|
+
*
|
|
34
|
+
* @memberof rbush
|
|
35
|
+
* @param {Feature} feature remove single GeoJSON Feature
|
|
36
|
+
* @param {Function} equals Pass a custom equals function to compare by value for removal.
|
|
37
|
+
* @returns {RBush} GeoJSON RBush
|
|
38
|
+
* @example
|
|
39
|
+
* var poly = turf.polygon([[[-78, 41], [-67, 41], [-67, 48], [-78, 48], [-78, 41]]]);
|
|
40
|
+
*
|
|
41
|
+
* tree.remove(poly);
|
|
42
|
+
*/
|
|
43
|
+
remove(feature: Feature<G, P>, equals?: (a: Feature<G, P>, b: Feature<G, P>) => boolean): this;
|
|
44
|
+
/**
|
|
45
|
+
* [clear](https://github.com/mourner/rbush#removing-data)
|
|
46
|
+
*
|
|
47
|
+
* @memberof rbush
|
|
48
|
+
* @returns {RBush} GeoJSON Rbush
|
|
49
|
+
* @example
|
|
50
|
+
* tree.clear()
|
|
51
|
+
*/
|
|
52
|
+
clear(): this;
|
|
53
|
+
/**
|
|
54
|
+
* [search](https://github.com/mourner/rbush#search)
|
|
55
|
+
*
|
|
56
|
+
* @memberof rbush
|
|
57
|
+
* @param {BBox|FeatureCollection|Feature} geojson search with GeoJSON
|
|
58
|
+
* @returns {FeatureCollection} all features that intersects with the given GeoJSON.
|
|
59
|
+
* @example
|
|
60
|
+
* var poly = turf.polygon([[[-78, 41], [-67, 41], [-67, 48], [-78, 48], [-78, 41]]]);
|
|
61
|
+
*
|
|
62
|
+
* tree.search(poly);
|
|
63
|
+
*/
|
|
64
|
+
search(geojson: Feature | FeatureCollection | BBox): FeatureCollection<G, P>;
|
|
65
|
+
/**
|
|
66
|
+
* [collides](https://github.com/mourner/rbush#collisions)
|
|
67
|
+
*
|
|
68
|
+
* @memberof rbush
|
|
69
|
+
* @param {BBox|FeatureCollection|Feature} geojson collides with GeoJSON
|
|
70
|
+
* @returns {boolean} true if there are any items intersecting the given GeoJSON, otherwise false.
|
|
71
|
+
* @example
|
|
72
|
+
* var poly = turf.polygon([[[-78, 41], [-67, 41], [-67, 48], [-78, 48], [-78, 41]]]);
|
|
73
|
+
*
|
|
74
|
+
* tree.collides(poly);
|
|
75
|
+
*/
|
|
76
|
+
collides(geojson: Feature | FeatureCollection | BBox): boolean;
|
|
77
|
+
/**
|
|
78
|
+
* [all](https://github.com/mourner/rbush#search)
|
|
79
|
+
*
|
|
80
|
+
* @memberof rbush
|
|
81
|
+
* @returns {FeatureCollection} all the features in RBush
|
|
82
|
+
* @example
|
|
83
|
+
* tree.all()
|
|
84
|
+
*/
|
|
85
|
+
all(): FeatureCollection<G, P>;
|
|
86
|
+
/**
|
|
87
|
+
* [toJSON](https://github.com/mourner/rbush#export-and-import)
|
|
88
|
+
*
|
|
89
|
+
* @memberof rbush
|
|
90
|
+
* @returns {any} export data as JSON object
|
|
91
|
+
* @example
|
|
92
|
+
* var exported = tree.toJSON()
|
|
93
|
+
*/
|
|
94
|
+
toJSON(): any;
|
|
95
|
+
/**
|
|
96
|
+
* [fromJSON](https://github.com/mourner/rbush#export-and-import)
|
|
97
|
+
*
|
|
98
|
+
* @memberof rbush
|
|
99
|
+
* @param {any} json import previously exported data
|
|
100
|
+
* @returns {RBush} GeoJSON RBush
|
|
101
|
+
* @example
|
|
102
|
+
* var exported = {
|
|
103
|
+
* "children": [
|
|
104
|
+
* {
|
|
105
|
+
* "type": "Feature",
|
|
106
|
+
* "geometry": {
|
|
107
|
+
* "type": "Point",
|
|
108
|
+
* "coordinates": [110, 50]
|
|
109
|
+
* },
|
|
110
|
+
* "properties": {},
|
|
111
|
+
* "bbox": [110, 50, 110, 50]
|
|
112
|
+
* }
|
|
113
|
+
* ],
|
|
114
|
+
* "height": 1,
|
|
115
|
+
* "leaf": true,
|
|
116
|
+
* "minX": 110,
|
|
117
|
+
* "minY": 50,
|
|
118
|
+
* "maxX": 110,
|
|
119
|
+
* "maxY": 50
|
|
120
|
+
* }
|
|
121
|
+
* tree.fromJSON(exported)
|
|
122
|
+
*/
|
|
123
|
+
fromJSON(json: any): RBush<G, P>;
|
|
16
124
|
}
|
|
17
|
-
|
|
18
125
|
/**
|
|
19
|
-
* https://github.com/mourner/rbush
|
|
126
|
+
* GeoJSON implementation of [RBush](https://github.com/mourner/rbush#rbush) spatial index.
|
|
127
|
+
*
|
|
128
|
+
* @function rbush
|
|
129
|
+
* @param {number} [maxEntries=9] defines the maximum number of entries in a tree node. 9 (used by default) is a
|
|
130
|
+
* reasonable choice for most applications. Higher value means faster insertion and slower search, and vice versa.
|
|
131
|
+
* @returns {RBush} GeoJSON RBush
|
|
132
|
+
* @example
|
|
133
|
+
* var geojsonRbush = require('geojson-rbush').default;
|
|
134
|
+
* var tree = geojsonRbush();
|
|
20
135
|
*/
|
|
21
|
-
declare function geojsonRbush<
|
|
22
|
-
G extends Geometry = Geometry,
|
|
23
|
-
P extends GeoJsonProperties = GeoJsonProperties,
|
|
24
|
-
>(maxEntries?: number): RBush<G, P>;
|
|
136
|
+
declare function geojsonRbush<G extends Geometry, P extends GeoJsonProperties = GeoJsonProperties>(maxEntries?: number): RBush<G, P>;
|
|
25
137
|
|
|
26
138
|
export { geojsonRbush as default, geojsonRbush };
|
package/dist/esm/index.js
CHANGED
|
@@ -1,16 +1,59 @@
|
|
|
1
|
-
// index.
|
|
1
|
+
// index.ts
|
|
2
2
|
import rbush from "rbush";
|
|
3
3
|
import { featureCollection } from "@turf/helpers";
|
|
4
4
|
import { featureEach } from "@turf/meta";
|
|
5
5
|
import { bbox as turfBBox } from "@turf/bbox";
|
|
6
|
-
function
|
|
7
|
-
var
|
|
8
|
-
|
|
6
|
+
function toBBox(geojson) {
|
|
7
|
+
var bbox;
|
|
8
|
+
if (geojson.bbox) bbox = geojson.bbox;
|
|
9
|
+
else if (Array.isArray(geojson) && geojson.length === 4) bbox = geojson;
|
|
10
|
+
else if (Array.isArray(geojson) && geojson.length === 6)
|
|
11
|
+
bbox = [geojson[0], geojson[1], geojson[3], geojson[4]];
|
|
12
|
+
else if (geojson.type === "Feature") bbox = turfBBox(geojson);
|
|
13
|
+
else if (geojson.type === "FeatureCollection") bbox = turfBBox(geojson);
|
|
14
|
+
else throw new Error("invalid geojson");
|
|
15
|
+
return {
|
|
16
|
+
minX: bbox[0],
|
|
17
|
+
minY: bbox[1],
|
|
18
|
+
maxX: bbox[2],
|
|
19
|
+
maxY: bbox[3]
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
var RBush = class {
|
|
23
|
+
constructor(maxEntries = 9) {
|
|
24
|
+
this.tree = new rbush(maxEntries);
|
|
25
|
+
this.tree.toBBox = toBBox;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* [insert](https://github.com/mourner/rbush#data-format)
|
|
29
|
+
*
|
|
30
|
+
* @memberof rbush
|
|
31
|
+
* @param {Feature} feature insert single GeoJSON Feature
|
|
32
|
+
* @returns {RBush} GeoJSON RBush
|
|
33
|
+
* @example
|
|
34
|
+
* var poly = turf.polygon([[[-78, 41], [-67, 41], [-67, 48], [-78, 48], [-78, 41]]]);
|
|
35
|
+
* tree.insert(poly)
|
|
36
|
+
*/
|
|
37
|
+
insert(feature) {
|
|
9
38
|
if (feature.type !== "Feature") throw new Error("invalid feature");
|
|
10
39
|
feature.bbox = feature.bbox ? feature.bbox : turfBBox(feature);
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
40
|
+
this.tree.insert(feature);
|
|
41
|
+
return this;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* [load](https://github.com/mourner/rbush#bulk-inserting-data)
|
|
45
|
+
*
|
|
46
|
+
* @memberof rbush
|
|
47
|
+
* @param {FeatureCollection|Array<Feature>} features load entire GeoJSON FeatureCollection
|
|
48
|
+
* @returns {RBush} GeoJSON RBush
|
|
49
|
+
* @example
|
|
50
|
+
* var polys = turf.polygons([
|
|
51
|
+
* [[[-78, 41], [-67, 41], [-67, 48], [-78, 48], [-78, 41]]],
|
|
52
|
+
* [[[-93, 32], [-83, 32], [-83, 39], [-93, 39], [-93, 32]]]
|
|
53
|
+
* ]);
|
|
54
|
+
* tree.load(polys);
|
|
55
|
+
*/
|
|
56
|
+
load(features) {
|
|
14
57
|
var load = [];
|
|
15
58
|
if (Array.isArray(features)) {
|
|
16
59
|
features.forEach(function(feature) {
|
|
@@ -25,50 +68,126 @@ function geojsonRbush(maxEntries) {
|
|
|
25
68
|
load.push(feature);
|
|
26
69
|
});
|
|
27
70
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
71
|
+
this.tree.load(load);
|
|
72
|
+
return this;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* [remove](https://github.com/mourner/rbush#removing-data)
|
|
76
|
+
*
|
|
77
|
+
* @memberof rbush
|
|
78
|
+
* @param {Feature} feature remove single GeoJSON Feature
|
|
79
|
+
* @param {Function} equals Pass a custom equals function to compare by value for removal.
|
|
80
|
+
* @returns {RBush} GeoJSON RBush
|
|
81
|
+
* @example
|
|
82
|
+
* var poly = turf.polygon([[[-78, 41], [-67, 41], [-67, 48], [-78, 48], [-78, 41]]]);
|
|
83
|
+
*
|
|
84
|
+
* tree.remove(poly);
|
|
85
|
+
*/
|
|
86
|
+
remove(feature, equals) {
|
|
31
87
|
if (feature.type !== "Feature") throw new Error("invalid feature");
|
|
32
88
|
feature.bbox = feature.bbox ? feature.bbox : turfBBox(feature);
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
89
|
+
this.tree.remove(feature, equals);
|
|
90
|
+
return this;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* [clear](https://github.com/mourner/rbush#removing-data)
|
|
94
|
+
*
|
|
95
|
+
* @memberof rbush
|
|
96
|
+
* @returns {RBush} GeoJSON Rbush
|
|
97
|
+
* @example
|
|
98
|
+
* tree.clear()
|
|
99
|
+
*/
|
|
100
|
+
clear() {
|
|
101
|
+
this.tree.clear();
|
|
102
|
+
return this;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* [search](https://github.com/mourner/rbush#search)
|
|
106
|
+
*
|
|
107
|
+
* @memberof rbush
|
|
108
|
+
* @param {BBox|FeatureCollection|Feature} geojson search with GeoJSON
|
|
109
|
+
* @returns {FeatureCollection} all features that intersects with the given GeoJSON.
|
|
110
|
+
* @example
|
|
111
|
+
* var poly = turf.polygon([[[-78, 41], [-67, 41], [-67, 48], [-78, 48], [-78, 41]]]);
|
|
112
|
+
*
|
|
113
|
+
* tree.search(poly);
|
|
114
|
+
*/
|
|
115
|
+
search(geojson) {
|
|
116
|
+
var features = this.tree.search(toBBox(geojson));
|
|
40
117
|
return featureCollection(features);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* [collides](https://github.com/mourner/rbush#collisions)
|
|
121
|
+
*
|
|
122
|
+
* @memberof rbush
|
|
123
|
+
* @param {BBox|FeatureCollection|Feature} geojson collides with GeoJSON
|
|
124
|
+
* @returns {boolean} true if there are any items intersecting the given GeoJSON, otherwise false.
|
|
125
|
+
* @example
|
|
126
|
+
* var poly = turf.polygon([[[-78, 41], [-67, 41], [-67, 48], [-78, 48], [-78, 41]]]);
|
|
127
|
+
*
|
|
128
|
+
* tree.collides(poly);
|
|
129
|
+
*/
|
|
130
|
+
collides(geojson) {
|
|
131
|
+
return this.tree.collides(toBBox(geojson));
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* [all](https://github.com/mourner/rbush#search)
|
|
135
|
+
*
|
|
136
|
+
* @memberof rbush
|
|
137
|
+
* @returns {FeatureCollection} all the features in RBush
|
|
138
|
+
* @example
|
|
139
|
+
* tree.all()
|
|
140
|
+
*/
|
|
141
|
+
all() {
|
|
142
|
+
const features = this.tree.all();
|
|
47
143
|
return featureCollection(features);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* [toJSON](https://github.com/mourner/rbush#export-and-import)
|
|
147
|
+
*
|
|
148
|
+
* @memberof rbush
|
|
149
|
+
* @returns {any} export data as JSON object
|
|
150
|
+
* @example
|
|
151
|
+
* var exported = tree.toJSON()
|
|
152
|
+
*/
|
|
153
|
+
toJSON() {
|
|
154
|
+
return this.tree.toJSON();
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* [fromJSON](https://github.com/mourner/rbush#export-and-import)
|
|
158
|
+
*
|
|
159
|
+
* @memberof rbush
|
|
160
|
+
* @param {any} json import previously exported data
|
|
161
|
+
* @returns {RBush} GeoJSON RBush
|
|
162
|
+
* @example
|
|
163
|
+
* var exported = {
|
|
164
|
+
* "children": [
|
|
165
|
+
* {
|
|
166
|
+
* "type": "Feature",
|
|
167
|
+
* "geometry": {
|
|
168
|
+
* "type": "Point",
|
|
169
|
+
* "coordinates": [110, 50]
|
|
170
|
+
* },
|
|
171
|
+
* "properties": {},
|
|
172
|
+
* "bbox": [110, 50, 110, 50]
|
|
173
|
+
* }
|
|
174
|
+
* ],
|
|
175
|
+
* "height": 1,
|
|
176
|
+
* "leaf": true,
|
|
177
|
+
* "minX": 110,
|
|
178
|
+
* "minY": 50,
|
|
179
|
+
* "maxX": 110,
|
|
180
|
+
* "maxY": 50
|
|
181
|
+
* }
|
|
182
|
+
* tree.fromJSON(exported)
|
|
183
|
+
*/
|
|
184
|
+
fromJSON(json) {
|
|
185
|
+
this.tree.fromJSON(json);
|
|
186
|
+
return this;
|
|
187
|
+
}
|
|
188
|
+
};
|
|
189
|
+
function geojsonRbush(maxEntries) {
|
|
190
|
+
return new RBush(maxEntries);
|
|
72
191
|
}
|
|
73
192
|
var index_default = geojsonRbush;
|
|
74
193
|
export {
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../index.js"],"sourcesContent":["import rbush from \"rbush\";\nimport { featureCollection } from \"@turf/helpers\";\nimport { featureEach } from \"@turf/meta\";\nimport { bbox as turfBBox } from \"@turf/bbox\";\n\n/**\n * @module rbush\n */\n\n/**\n * GeoJSON implementation of [RBush](https://github.com/mourner/rbush#rbush) spatial index.\n *\n * @function rbush\n * @param {number} [maxEntries=9] defines the maximum number of entries in a tree node. 9 (used by default) is a\n * reasonable choice for most applications. Higher value means faster insertion and slower search, and vice versa.\n * @returns {RBush} GeoJSON RBush\n * @example\n * var geojsonRbush = require('geojson-rbush').default;\n * var tree = geojsonRbush();\n */\nfunction geojsonRbush(maxEntries) {\n var tree = new rbush(maxEntries);\n\n /**\n * [insert](https://github.com/mourner/rbush#data-format)\n *\n * @memberof rbush\n * @param {Feature} feature insert single GeoJSON Feature\n * @returns {RBush} GeoJSON RBush\n * @example\n * var poly = turf.polygon([[[-78, 41], [-67, 41], [-67, 48], [-78, 48], [-78, 41]]]);\n * tree.insert(poly)\n */\n tree.insert = function (feature) {\n if (feature.type !== \"Feature\") throw new Error(\"invalid feature\");\n feature.bbox = feature.bbox ? feature.bbox : turfBBox(feature);\n return rbush.prototype.insert.call(this, feature);\n };\n\n /**\n * [load](https://github.com/mourner/rbush#bulk-inserting-data)\n *\n * @memberof rbush\n * @param {FeatureCollection|Array<Feature>} features load entire GeoJSON FeatureCollection\n * @returns {RBush} GeoJSON RBush\n * @example\n * var polys = turf.polygons([\n * [[[-78, 41], [-67, 41], [-67, 48], [-78, 48], [-78, 41]]],\n * [[[-93, 32], [-83, 32], [-83, 39], [-93, 39], [-93, 32]]]\n * ]);\n * tree.load(polys);\n */\n tree.load = function (features) {\n var load = [];\n // Load an Array of Features\n if (Array.isArray(features)) {\n features.forEach(function (feature) {\n if (feature.type !== \"Feature\") throw new Error(\"invalid features\");\n feature.bbox = feature.bbox ? feature.bbox : turfBBox(feature);\n load.push(feature);\n });\n } else {\n // Load a FeatureCollection\n featureEach(features, function (feature) {\n if (feature.type !== \"Feature\") throw new Error(\"invalid features\");\n feature.bbox = feature.bbox ? feature.bbox : turfBBox(feature);\n load.push(feature);\n });\n }\n return rbush.prototype.load.call(this, load);\n };\n\n /**\n * [remove](https://github.com/mourner/rbush#removing-data)\n *\n * @memberof rbush\n * @param {Feature} feature remove single GeoJSON Feature\n * @param {Function} equals Pass a custom equals function to compare by value for removal.\n * @returns {RBush} GeoJSON RBush\n * @example\n * var poly = turf.polygon([[[-78, 41], [-67, 41], [-67, 48], [-78, 48], [-78, 41]]]);\n *\n * tree.remove(poly);\n */\n tree.remove = function (feature, equals) {\n if (feature.type !== \"Feature\") throw new Error(\"invalid feature\");\n feature.bbox = feature.bbox ? feature.bbox : turfBBox(feature);\n return rbush.prototype.remove.call(this, feature, equals);\n };\n\n /**\n * [clear](https://github.com/mourner/rbush#removing-data)\n *\n * @memberof rbush\n * @returns {RBush} GeoJSON Rbush\n * @example\n * tree.clear()\n */\n tree.clear = function () {\n return rbush.prototype.clear.call(this);\n };\n\n /**\n * [search](https://github.com/mourner/rbush#search)\n *\n * @memberof rbush\n * @param {BBox|FeatureCollection|Feature} geojson search with GeoJSON\n * @returns {FeatureCollection} all features that intersects with the given GeoJSON.\n * @example\n * var poly = turf.polygon([[[-78, 41], [-67, 41], [-67, 48], [-78, 48], [-78, 41]]]);\n *\n * tree.search(poly);\n */\n tree.search = function (geojson) {\n var features = rbush.prototype.search.call(this, this.toBBox(geojson));\n return featureCollection(features);\n };\n\n /**\n * [collides](https://github.com/mourner/rbush#collisions)\n *\n * @memberof rbush\n * @param {BBox|FeatureCollection|Feature} geojson collides with GeoJSON\n * @returns {boolean} true if there are any items intersecting the given GeoJSON, otherwise false.\n * @example\n * var poly = turf.polygon([[[-78, 41], [-67, 41], [-67, 48], [-78, 48], [-78, 41]]]);\n *\n * tree.collides(poly);\n */\n tree.collides = function (geojson) {\n return rbush.prototype.collides.call(this, this.toBBox(geojson));\n };\n\n /**\n * [all](https://github.com/mourner/rbush#search)\n *\n * @memberof rbush\n * @returns {FeatureCollection} all the features in RBush\n * @example\n * tree.all()\n */\n tree.all = function () {\n var features = rbush.prototype.all.call(this);\n return featureCollection(features);\n };\n\n /**\n * [toJSON](https://github.com/mourner/rbush#export-and-import)\n *\n * @memberof rbush\n * @returns {any} export data as JSON object\n * @example\n * var exported = tree.toJSON()\n */\n tree.toJSON = function () {\n return rbush.prototype.toJSON.call(this);\n };\n\n /**\n * [fromJSON](https://github.com/mourner/rbush#export-and-import)\n *\n * @memberof rbush\n * @param {any} json import previously exported data\n * @returns {RBush} GeoJSON RBush\n * @example\n * var exported = {\n * \"children\": [\n * {\n * \"type\": \"Feature\",\n * \"geometry\": {\n * \"type\": \"Point\",\n * \"coordinates\": [110, 50]\n * },\n * \"properties\": {},\n * \"bbox\": [110, 50, 110, 50]\n * }\n * ],\n * \"height\": 1,\n * \"leaf\": true,\n * \"minX\": 110,\n * \"minY\": 50,\n * \"maxX\": 110,\n * \"maxY\": 50\n * }\n * tree.fromJSON(exported)\n */\n tree.fromJSON = function (json) {\n return rbush.prototype.fromJSON.call(this, json);\n };\n\n /**\n * Converts GeoJSON to {minX, minY, maxX, maxY} schema\n *\n * @memberof rbush\n * @private\n * @param {BBox|FeatureCollection|Feature} geojson feature(s) to retrieve BBox from\n * @returns {Object} converted to {minX, minY, maxX, maxY}\n */\n tree.toBBox = function (geojson) {\n var bbox;\n if (geojson.bbox) bbox = geojson.bbox;\n else if (Array.isArray(geojson) && geojson.length === 4) bbox = geojson;\n else if (Array.isArray(geojson) && geojson.length === 6)\n bbox = [geojson[0], geojson[1], geojson[3], geojson[4]];\n else if (geojson.type === \"Feature\") bbox = turfBBox(geojson);\n else if (geojson.type === \"FeatureCollection\") bbox = turfBBox(geojson);\n else throw new Error(\"invalid geojson\");\n\n return {\n minX: bbox[0],\n minY: bbox[1],\n maxX: bbox[2],\n maxY: bbox[3],\n };\n };\n return tree;\n}\n\nexport { geojsonRbush };\nexport default geojsonRbush;\n"],"mappings":";AAAA,OAAO,WAAW;AAClB,SAAS,yBAAyB;AAClC,SAAS,mBAAmB;AAC5B,SAAS,QAAQ,gBAAgB;AAiBjC,SAAS,aAAa,YAAY;AAChC,MAAI,OAAO,IAAI,MAAM,UAAU;AAY/B,OAAK,SAAS,SAAU,SAAS;AAC/B,QAAI,QAAQ,SAAS,UAAW,OAAM,IAAI,MAAM,iBAAiB;AACjE,YAAQ,OAAO,QAAQ,OAAO,QAAQ,OAAO,SAAS,OAAO;AAC7D,WAAO,MAAM,UAAU,OAAO,KAAK,MAAM,OAAO;AAAA,EAClD;AAeA,OAAK,OAAO,SAAU,UAAU;AAC9B,QAAI,OAAO,CAAC;AAEZ,QAAI,MAAM,QAAQ,QAAQ,GAAG;AAC3B,eAAS,QAAQ,SAAU,SAAS;AAClC,YAAI,QAAQ,SAAS,UAAW,OAAM,IAAI,MAAM,kBAAkB;AAClE,gBAAQ,OAAO,QAAQ,OAAO,QAAQ,OAAO,SAAS,OAAO;AAC7D,aAAK,KAAK,OAAO;AAAA,MACnB,CAAC;AAAA,IACH,OAAO;AAEL,kBAAY,UAAU,SAAU,SAAS;AACv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,OAAO,KAAK,QAAQ,WAAW;AACpD,aAAO,CAAC,QAAQ,CAAC,GAAG,QAAQ,CAAC,GAAG,QAAQ,CAAC,GAAG,QAAQ,CAAC,CAAC;AAAA,aAC/C,QAAQ,SAAS,UAAW,QAAO,SAAS,OAAO;AAAA,aACnD,QAAQ,SAAS,oBAAqB,QAAO,SAAS,OAAO;AAAA,QACjE,OAAM,IAAI,MAAM,iBAAiB;AAEtC,WAAO;AAAA,MACL,MAAM,KAAK,CAAC;AAAA,MACZ,MAAM,KAAK,CAAC;AAAA,MACZ,MAAM,KAAK,CAAC;AAAA,MACZ,MAAM,KAAK,CAAC;AAAA,IACd;AAAA,EACF;AACA,SAAO;AACT;AAGA,IAAO,gBAAQ;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../index.ts"],"sourcesContent":["import rbush from \"rbush\";\nimport { featureCollection } from \"@turf/helpers\";\nimport { featureEach } from \"@turf/meta\";\nimport { bbox as turfBBox } from \"@turf/bbox\";\nimport {\n BBox,\n Feature,\n FeatureCollection,\n GeoJsonProperties,\n Geometry,\n} from \"geojson\";\n\n/**\n * @module rbush\n */\n\n/**\n * Converts GeoJSON to {minX, minY, maxX, maxY} schema\n *\n * @memberof rbush\n * @private\n * @param {BBox|FeatureCollection|Feature} geojson feature(s) to retrieve BBox from\n * @returns {Object} converted to {minX, minY, maxX, maxY}\n */\nfunction toBBox(geojson: BBox | FeatureCollection | Feature) {\n var bbox;\n if ((geojson as any).bbox) bbox = (geojson as any).bbox;\n else if (Array.isArray(geojson) && geojson.length === 4) bbox = geojson;\n else if (Array.isArray(geojson) && geojson.length === 6)\n bbox = [geojson[0], geojson[1], geojson[3], geojson[4]];\n else if (geojson.type === \"Feature\") bbox = turfBBox(geojson);\n else if (geojson.type === \"FeatureCollection\") bbox = turfBBox(geojson);\n else throw new Error(\"invalid geojson\");\n\n return {\n minX: bbox[0],\n minY: bbox[1],\n maxX: bbox[2],\n maxY: bbox[3],\n };\n}\n\nclass RBush<G extends Geometry, P extends GeoJsonProperties> {\n private tree: rbush<Feature<G, P>>;\n\n constructor(maxEntries = 9) {\n this.tree = new rbush<Feature<G, P>>(maxEntries);\n // When we load features into the underlying rbush instance, it has to be able to correctly\n // handle GeoJSON bbox values while inserting into the data structure. The rest of the API\n // can just be a passthrough wrapping class.\n this.tree.toBBox = toBBox;\n }\n\n /**\n * [insert](https://github.com/mourner/rbush#data-format)\n *\n * @memberof rbush\n * @param {Feature} feature insert single GeoJSON Feature\n * @returns {RBush} GeoJSON RBush\n * @example\n * var poly = turf.polygon([[[-78, 41], [-67, 41], [-67, 48], [-78, 48], [-78, 41]]]);\n * tree.insert(poly)\n */\n insert(feature: Feature<G, P>): RBush<G, P> {\n if (feature.type !== \"Feature\") throw new Error(\"invalid feature\");\n feature.bbox = feature.bbox ? feature.bbox : turfBBox(feature);\n this.tree.insert(feature);\n return this;\n }\n\n /**\n * [load](https://github.com/mourner/rbush#bulk-inserting-data)\n *\n * @memberof rbush\n * @param {FeatureCollection|Array<Feature>} features load entire GeoJSON FeatureCollection\n * @returns {RBush} GeoJSON RBush\n * @example\n * var polys = turf.polygons([\n * [[[-78, 41], [-67, 41], [-67, 48], [-78, 48], [-78, 41]]],\n * [[[-93, 32], [-83, 32], [-83, 39], [-93, 39], [-93, 32]]]\n * ]);\n * tree.load(polys);\n */\n load(features: FeatureCollection<G, P> | Feature<G, P>[]): RBush<G, P> {\n var load: Feature<G, P>[] = [];\n // Load an Array of Features\n if (Array.isArray(features)) {\n features.forEach(function (feature) {\n if (feature.type !== \"Feature\") throw new Error(\"invalid features\");\n feature.bbox = feature.bbox ? feature.bbox : turfBBox(feature);\n load.push(feature);\n });\n } else {\n // Load a FeatureCollection\n featureEach(features, function (feature) {\n if (feature.type !== \"Feature\") throw new Error(\"invalid features\");\n feature.bbox = feature.bbox ? feature.bbox : turfBBox(feature);\n load.push(feature);\n });\n }\n this.tree.load(load);\n return this;\n }\n\n /**\n * [remove](https://github.com/mourner/rbush#removing-data)\n *\n * @memberof rbush\n * @param {Feature} feature remove single GeoJSON Feature\n * @param {Function} equals Pass a custom equals function to compare by value for removal.\n * @returns {RBush} GeoJSON RBush\n * @example\n * var poly = turf.polygon([[[-78, 41], [-67, 41], [-67, 48], [-78, 48], [-78, 41]]]);\n *\n * tree.remove(poly);\n */\n remove(\n feature: Feature<G, P>,\n equals?: (a: Feature<G, P>, b: Feature<G, P>) => boolean\n ) {\n if (feature.type !== \"Feature\") throw new Error(\"invalid feature\");\n feature.bbox = feature.bbox ? feature.bbox : turfBBox(feature);\n this.tree.remove(feature, equals);\n return this;\n }\n\n /**\n * [clear](https://github.com/mourner/rbush#removing-data)\n *\n * @memberof rbush\n * @returns {RBush} GeoJSON Rbush\n * @example\n * tree.clear()\n */\n clear() {\n this.tree.clear();\n return this;\n }\n\n /**\n * [search](https://github.com/mourner/rbush#search)\n *\n * @memberof rbush\n * @param {BBox|FeatureCollection|Feature} geojson search with GeoJSON\n * @returns {FeatureCollection} all features that intersects with the given GeoJSON.\n * @example\n * var poly = turf.polygon([[[-78, 41], [-67, 41], [-67, 48], [-78, 48], [-78, 41]]]);\n *\n * tree.search(poly);\n */\n search(geojson: Feature | FeatureCollection | BBox): FeatureCollection<G, P> {\n var features = this.tree.search(toBBox(geojson));\n return featureCollection(features);\n }\n\n /**\n * [collides](https://github.com/mourner/rbush#collisions)\n *\n * @memberof rbush\n * @param {BBox|FeatureCollection|Feature} geojson collides with GeoJSON\n * @returns {boolean} true if there are any items intersecting the given GeoJSON, otherwise false.\n * @example\n * var poly = turf.polygon([[[-78, 41], [-67, 41], [-67, 48], [-78, 48], [-78, 41]]]);\n *\n * tree.collides(poly);\n */\n collides(geojson: Feature | FeatureCollection | BBox): boolean {\n return this.tree.collides(toBBox(geojson));\n }\n\n /**\n * [all](https://github.com/mourner/rbush#search)\n *\n * @memberof rbush\n * @returns {FeatureCollection} all the features in RBush\n * @example\n * tree.all()\n */\n all() {\n const features = this.tree.all();\n return featureCollection(features);\n }\n\n /**\n * [toJSON](https://github.com/mourner/rbush#export-and-import)\n *\n * @memberof rbush\n * @returns {any} export data as JSON object\n * @example\n * var exported = tree.toJSON()\n */\n toJSON() {\n return this.tree.toJSON();\n }\n\n /**\n * [fromJSON](https://github.com/mourner/rbush#export-and-import)\n *\n * @memberof rbush\n * @param {any} json import previously exported data\n * @returns {RBush} GeoJSON RBush\n * @example\n * var exported = {\n * \"children\": [\n * {\n * \"type\": \"Feature\",\n * \"geometry\": {\n * \"type\": \"Point\",\n * \"coordinates\": [110, 50]\n * },\n * \"properties\": {},\n * \"bbox\": [110, 50, 110, 50]\n * }\n * ],\n * \"height\": 1,\n * \"leaf\": true,\n * \"minX\": 110,\n * \"minY\": 50,\n * \"maxX\": 110,\n * \"maxY\": 50\n * }\n * tree.fromJSON(exported)\n */\n fromJSON(json: any): RBush<G, P> {\n this.tree.fromJSON(json);\n return this;\n }\n}\n\n/**\n * GeoJSON implementation of [RBush](https://github.com/mourner/rbush#rbush) spatial index.\n *\n * @function rbush\n * @param {number} [maxEntries=9] defines the maximum number of entries in a tree node. 9 (used by default) is a\n * reasonable choice for most applications. Higher value means faster insertion and slower search, and vice versa.\n * @returns {RBush} GeoJSON RBush\n * @example\n * var geojsonRbush = require('geojson-rbush').default;\n * var tree = geojsonRbush();\n */\nfunction geojsonRbush<\n G extends Geometry,\n P extends GeoJsonProperties = GeoJsonProperties,\n>(maxEntries?: number) {\n return new RBush<G, P>(maxEntries);\n}\n\nexport { geojsonRbush };\nexport default geojsonRbush;\n"],"mappings":";AAAA,OAAO,WAAW;AAClB,SAAS,yBAAyB;AAClC,SAAS,mBAAmB;AAC5B,SAAS,QAAQ,gBAAgB;AAqBjC,SAAS,OAAO,SAA6C;AAC3D,MAAI;AACJ,MAAK,QAAgB,KAAM,QAAQ,QAAgB;AAAA,WAC1C,MAAM,QAAQ,OAAO,KAAK,QAAQ,WAAW,EAAG,QAAO;AAAA,WACvD,MAAM,QAAQ,OAAO,KAAK,QAAQ,WAAW;AACpD,WAAO,CA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;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EA8BA,SAAS,MAAwB;AAC/B,SAAK,KAAK,SAAS,IAAI;AACvB,WAAO;AAAA,EACT;AACF;AAaA,SAAS,aAGP,YAAqB;AACrB,SAAO,IAAI,MAAY,UAAU;AACnC;AAGA,IAAO,gBAAQ;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@turf/geojson-rbush",
|
|
3
|
-
"version": "7.3.
|
|
3
|
+
"version": "7.3.3",
|
|
4
4
|
"description": "GeoJSON implementation of RBush",
|
|
5
5
|
"author": "Turf Authors",
|
|
6
6
|
"contributors": [
|
|
@@ -58,9 +58,10 @@
|
|
|
58
58
|
"test:types": "tsc --esModuleInterop --module node16 --moduleResolution node16 --noEmit --strict types.ts"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
|
-
"@turf/bbox-polygon": "7.3.
|
|
62
|
-
"@turf/random": "7.3.
|
|
61
|
+
"@turf/bbox-polygon": "7.3.3",
|
|
62
|
+
"@turf/random": "7.3.3",
|
|
63
63
|
"@types/benchmark": "^2.1.5",
|
|
64
|
+
"@types/rbush": "^3.0.4",
|
|
64
65
|
"@types/tape": "^5.8.1",
|
|
65
66
|
"benchmark": "^2.1.4",
|
|
66
67
|
"load-json-file": "^7.0.1",
|
|
@@ -71,11 +72,12 @@
|
|
|
71
72
|
"write-json-file": "^6.0.0"
|
|
72
73
|
},
|
|
73
74
|
"dependencies": {
|
|
74
|
-
"@turf/bbox": "7.3.
|
|
75
|
-
"@turf/helpers": "7.3.
|
|
76
|
-
"@turf/meta": "7.3.
|
|
75
|
+
"@turf/bbox": "7.3.3",
|
|
76
|
+
"@turf/helpers": "7.3.3",
|
|
77
|
+
"@turf/meta": "7.3.3",
|
|
77
78
|
"@types/geojson": "^7946.0.10",
|
|
78
|
-
"rbush": "^3.0.1"
|
|
79
|
+
"rbush": "^3.0.1",
|
|
80
|
+
"tslib": "^2.8.1"
|
|
79
81
|
},
|
|
80
|
-
"gitHead": "
|
|
82
|
+
"gitHead": "fa0e2da8ce02d9a82720eae922f89c9386596e04"
|
|
81
83
|
}
|