@osmix/core 0.2.0 → 0.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/CHANGELOG.md +31 -0
- package/README.md +54 -7
- package/dist/contracts.d.ts +2 -1
- package/dist/contracts.d.ts.map +1 -1
- package/dist/entities.d.ts +21 -1
- package/dist/entities.d.ts.map +1 -1
- package/dist/entities.js +52 -3
- package/dist/entities.js.map +1 -1
- package/dist/ids.d.ts +18 -5
- package/dist/ids.d.ts.map +1 -1
- package/dist/ids.js +68 -18
- package/dist/ids.js.map +1 -1
- package/dist/index.d.ts +6 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -3
- package/dist/index.js.map +1 -1
- package/dist/indirect-kd-index.d.ts +28 -0
- package/dist/indirect-kd-index.d.ts.map +1 -0
- package/dist/indirect-kd-index.js +163 -0
- package/dist/indirect-kd-index.js.map +1 -0
- package/dist/limits.d.ts +30 -0
- package/dist/limits.d.ts.map +1 -0
- package/dist/limits.js +51 -0
- package/dist/limits.js.map +1 -0
- package/dist/nodes.d.ts +28 -13
- package/dist/nodes.d.ts.map +1 -1
- package/dist/nodes.js +181 -51
- package/dist/nodes.js.map +1 -1
- package/dist/osm.d.ts +59 -3
- package/dist/osm.d.ts.map +1 -1
- package/dist/osm.js +31 -2
- package/dist/osm.js.map +1 -1
- package/dist/relations.d.ts +10 -4
- package/dist/relations.d.ts.map +1 -1
- package/dist/relations.js +66 -28
- package/dist/relations.js.map +1 -1
- package/dist/renumber.d.ts +23 -0
- package/dist/renumber.d.ts.map +1 -0
- package/dist/renumber.js +64 -0
- package/dist/renumber.js.map +1 -0
- package/dist/stringtable.d.ts +2 -1
- package/dist/stringtable.d.ts.map +1 -1
- package/dist/stringtable.js +5 -1
- package/dist/stringtable.js.map +1 -1
- package/dist/tags.d.ts +44 -11
- package/dist/tags.d.ts.map +1 -1
- package/dist/tags.js +153 -27
- package/dist/tags.js.map +1 -1
- package/dist/typed-arrays.d.ts +63 -48
- package/dist/typed-arrays.d.ts.map +1 -1
- package/dist/typed-arrays.js +184 -107
- package/dist/typed-arrays.js.map +1 -1
- package/dist/ways.d.ts +50 -2
- package/dist/ways.d.ts.map +1 -1
- package/dist/ways.js +212 -35
- package/dist/ways.js.map +1 -1
- package/package.json +11 -12
- package/src/contracts.ts +2 -1
- package/src/entities.ts +67 -4
- package/src/ids.ts +72 -22
- package/src/index.ts +13 -7
- package/src/indirect-kd-index.ts +212 -0
- package/src/limits.ts +73 -0
- package/src/nodes.ts +228 -54
- package/src/osm.ts +90 -4
- package/src/relations.ts +80 -30
- package/src/renumber.ts +80 -0
- package/src/stringtable.ts +15 -1
- package/src/tags.ts +173 -31
- package/src/typed-arrays.ts +225 -113
- package/src/ways.ts +233 -38
- package/test/entity-index-errors.test.ts +41 -0
- package/test/ids.bench.ts +11 -7
- package/test/ids.test.ts +38 -0
- package/test/limits.test.ts +83 -0
- package/test/no-shared-array-buffer.test.ts +41 -0
- package/test/nodes-spatial-index.test.ts +261 -0
- package/test/osm-bbox.test.ts +30 -0
- package/test/relations.bench.ts +9 -4
- package/test/relations.test.ts +52 -29
- package/test/renumber.test.ts +54 -0
- package/test/spatial-index-rebuild.test.ts +33 -0
- package/test/storage-compaction.test.ts +269 -0
- package/test/tags-search.test.ts +13 -0
- package/test/typed-arrays.test.ts +178 -59
- package/src/types/geokdbush.d.ts +0 -32
- package/src/types/kdbush.d.ts +0 -47
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A compact static KD index over coordinate columns owned by another object.
|
|
3
|
+
*
|
|
4
|
+
* The selection and traversal algorithms are adapted from KDBush 4.1.0,
|
|
5
|
+
* Copyright (c) 2018 Vladimir Agafonkin, distributed under the ISC License.
|
|
6
|
+
* Unlike KDBush, this index stores only a Uint32 permutation. Coordinates are
|
|
7
|
+
* dereferenced from the existing Int32 microdegree columns.
|
|
8
|
+
*/
|
|
9
|
+
import type { BufferType } from "./typed-arrays.ts";
|
|
10
|
+
export declare class IndirectKdIndex {
|
|
11
|
+
readonly indexes: Uint32Array;
|
|
12
|
+
private readonly lons;
|
|
13
|
+
private readonly lats;
|
|
14
|
+
private readonly nodeSize;
|
|
15
|
+
constructor(lons: Int32Array, lats: Int32Array, indexes: Uint32Array, nodeSize?: number);
|
|
16
|
+
static build(lons: Int32Array, lats: Int32Array, count: number, fill: (indexes: Uint32Array) => void): IndirectKdIndex;
|
|
17
|
+
static from(lons: Int32Array, lats: Int32Array, buffer: BufferType): IndirectKdIndex;
|
|
18
|
+
get buffer(): BufferType;
|
|
19
|
+
/**
|
|
20
|
+
* Find entity indexes within an inclusive bounding box.
|
|
21
|
+
*
|
|
22
|
+
* Bounds are **integer microdegrees** (the units of the underlying Int32
|
|
23
|
+
* coordinate columns), not degrees. `Nodes.findIndexesWithinBbox` performs
|
|
24
|
+
* the degree → microdegree conversion.
|
|
25
|
+
*/
|
|
26
|
+
range(minLon: number, minLat: number, maxLon: number, maxLat: number): number[];
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=indirect-kd-index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"indirect-kd-index.d.ts","sourceRoot":"","sources":["../src/indirect-kd-index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAKpD,qBAAa,eAAe;IAC1B,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC;IAC9B,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAa;IAClC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAa;IAClC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAS;IAElC,YACE,IAAI,EAAE,UAAU,EAChB,IAAI,EAAE,UAAU,EAChB,OAAO,EAAE,WAAW,EACpB,QAAQ,SAAoB,EAM7B;IAED,MAAM,CAAC,KAAK,CACV,IAAI,EAAE,UAAU,EAChB,IAAI,EAAE,UAAU,EAChB,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,CAAC,OAAO,EAAE,WAAW,KAAK,IAAI,GACnC,eAAe,CAMjB;IAED,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,GAAG,eAAe,CAKnF;IAED,IAAI,MAAM,IAAI,UAAU,CAEvB;IAED;;;;;;OAMG;IACH,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAyC9E;CACF"}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A compact static KD index over coordinate columns owned by another object.
|
|
3
|
+
*
|
|
4
|
+
* The selection and traversal algorithms are adapted from KDBush 4.1.0,
|
|
5
|
+
* Copyright (c) 2018 Vladimir Agafonkin, distributed under the ISC License.
|
|
6
|
+
* Unlike KDBush, this index stores only a Uint32 permutation. Coordinates are
|
|
7
|
+
* dereferenced from the existing Int32 microdegree columns.
|
|
8
|
+
*/
|
|
9
|
+
import { BufferConstructor } from "./typed-arrays.js";
|
|
10
|
+
const DEFAULT_NODE_SIZE = 64;
|
|
11
|
+
export class IndirectKdIndex {
|
|
12
|
+
indexes;
|
|
13
|
+
lons;
|
|
14
|
+
lats;
|
|
15
|
+
nodeSize;
|
|
16
|
+
constructor(lons, lats, indexes, nodeSize = DEFAULT_NODE_SIZE) {
|
|
17
|
+
this.lons = lons;
|
|
18
|
+
this.lats = lats;
|
|
19
|
+
this.indexes = indexes;
|
|
20
|
+
this.nodeSize = nodeSize;
|
|
21
|
+
}
|
|
22
|
+
static build(lons, lats, count, fill) {
|
|
23
|
+
const buffer = new BufferConstructor(count * Uint32Array.BYTES_PER_ELEMENT);
|
|
24
|
+
const indexes = new Uint32Array(buffer);
|
|
25
|
+
fill(indexes);
|
|
26
|
+
sortKd(indexes, lons, lats, DEFAULT_NODE_SIZE, 0, indexes.length - 1, 0);
|
|
27
|
+
return new IndirectKdIndex(lons, lats, indexes);
|
|
28
|
+
}
|
|
29
|
+
static from(lons, lats, buffer) {
|
|
30
|
+
if (buffer.byteLength % Uint32Array.BYTES_PER_ELEMENT !== 0) {
|
|
31
|
+
throw new Error("Indirect KD index buffer length must be divisible by four");
|
|
32
|
+
}
|
|
33
|
+
return new IndirectKdIndex(lons, lats, new Uint32Array(buffer));
|
|
34
|
+
}
|
|
35
|
+
get buffer() {
|
|
36
|
+
return this.indexes.buffer;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Find entity indexes within an inclusive bounding box.
|
|
40
|
+
*
|
|
41
|
+
* Bounds are **integer microdegrees** (the units of the underlying Int32
|
|
42
|
+
* coordinate columns), not degrees. `Nodes.findIndexesWithinBbox` performs
|
|
43
|
+
* the degree → microdegree conversion.
|
|
44
|
+
*/
|
|
45
|
+
range(minLon, minLat, maxLon, maxLat) {
|
|
46
|
+
const stack = [0, this.indexes.length - 1, 0];
|
|
47
|
+
const result = [];
|
|
48
|
+
while (stack.length > 0) {
|
|
49
|
+
const axis = stack.pop();
|
|
50
|
+
const right = stack.pop();
|
|
51
|
+
const left = stack.pop();
|
|
52
|
+
if (axis === undefined || right === undefined || left === undefined) {
|
|
53
|
+
throw new Error("Indirect KD index traversal stack is corrupt");
|
|
54
|
+
}
|
|
55
|
+
if (right - left <= this.nodeSize) {
|
|
56
|
+
for (let i = left; i <= right; i++) {
|
|
57
|
+
const entityIndex = entityAt(this.indexes, i);
|
|
58
|
+
const lon = coordinate(this.lons, this.lats, entityIndex, 0);
|
|
59
|
+
const lat = coordinate(this.lons, this.lats, entityIndex, 1);
|
|
60
|
+
if (lon >= minLon && lon <= maxLon && lat >= minLat && lat <= maxLat) {
|
|
61
|
+
result.push(entityIndex);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
continue;
|
|
65
|
+
}
|
|
66
|
+
const middle = (left + right) >> 1;
|
|
67
|
+
const entityIndex = entityAt(this.indexes, middle);
|
|
68
|
+
const lon = coordinate(this.lons, this.lats, entityIndex, 0);
|
|
69
|
+
const lat = coordinate(this.lons, this.lats, entityIndex, 1);
|
|
70
|
+
if (lon >= minLon && lon <= maxLon && lat >= minLat && lat <= maxLat) {
|
|
71
|
+
result.push(entityIndex);
|
|
72
|
+
}
|
|
73
|
+
const splitCoordinate = axis === 0 ? lon : lat;
|
|
74
|
+
const minimum = axis === 0 ? minLon : minLat;
|
|
75
|
+
const maximum = axis === 0 ? maxLon : maxLat;
|
|
76
|
+
if (minimum <= splitCoordinate)
|
|
77
|
+
stack.push(left, middle - 1, 1 - axis);
|
|
78
|
+
if (maximum >= splitCoordinate)
|
|
79
|
+
stack.push(middle + 1, right, 1 - axis);
|
|
80
|
+
}
|
|
81
|
+
return result;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
function sortKd(indexes, lons, lats, nodeSize, left, right, axis) {
|
|
85
|
+
if (right - left <= nodeSize)
|
|
86
|
+
return;
|
|
87
|
+
const middle = (left + right) >> 1;
|
|
88
|
+
select(indexes, lons, lats, middle, left, right, axis);
|
|
89
|
+
sortKd(indexes, lons, lats, nodeSize, left, middle - 1, 1 - axis);
|
|
90
|
+
sortKd(indexes, lons, lats, nodeSize, middle + 1, right, 1 - axis);
|
|
91
|
+
}
|
|
92
|
+
/** Floyd-Rivest selection adapted to dereference coordinates indirectly. */
|
|
93
|
+
function select(indexes, lons, lats, k, initialLeft, initialRight, axis) {
|
|
94
|
+
let left = initialLeft;
|
|
95
|
+
let right = initialRight;
|
|
96
|
+
while (right > left) {
|
|
97
|
+
if (right - left > 600) {
|
|
98
|
+
const n = right - left + 1;
|
|
99
|
+
const m = k - left + 1;
|
|
100
|
+
const z = Math.log(n);
|
|
101
|
+
const s = 0.5 * Math.exp((2 * z) / 3);
|
|
102
|
+
const sd = 0.5 * Math.sqrt((z * s * (n - s)) / n) * (m - n / 2 < 0 ? -1 : 1);
|
|
103
|
+
const newLeft = Math.max(left, Math.floor(k - (m * s) / n + sd));
|
|
104
|
+
const newRight = Math.min(right, Math.floor(k + ((n - m) * s) / n + sd));
|
|
105
|
+
select(indexes, lons, lats, k, newLeft, newRight, axis);
|
|
106
|
+
}
|
|
107
|
+
const pivotIndex = entityAt(indexes, k);
|
|
108
|
+
const pivot = coordinate(lons, lats, pivotIndex, axis);
|
|
109
|
+
let i = left;
|
|
110
|
+
let j = right;
|
|
111
|
+
swap(indexes, left, k);
|
|
112
|
+
if (compareCoordinate(lons, lats, entityAt(indexes, right), pivotIndex, axis) > 0) {
|
|
113
|
+
swap(indexes, left, right);
|
|
114
|
+
}
|
|
115
|
+
while (i < j) {
|
|
116
|
+
swap(indexes, i, j);
|
|
117
|
+
i++;
|
|
118
|
+
j--;
|
|
119
|
+
while (i <= right && coordinate(lons, lats, entityAt(indexes, i), axis) < pivot)
|
|
120
|
+
i++;
|
|
121
|
+
while (j >= left && coordinate(lons, lats, entityAt(indexes, j), axis) > pivot)
|
|
122
|
+
j--;
|
|
123
|
+
}
|
|
124
|
+
if (coordinate(lons, lats, entityAt(indexes, left), axis) === pivot) {
|
|
125
|
+
swap(indexes, left, j);
|
|
126
|
+
}
|
|
127
|
+
else {
|
|
128
|
+
j++;
|
|
129
|
+
swap(indexes, j, right);
|
|
130
|
+
}
|
|
131
|
+
if (j <= k)
|
|
132
|
+
left = j + 1;
|
|
133
|
+
if (k <= j)
|
|
134
|
+
right = j - 1;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Read the permutation entry at `position`, throwing on an out-of-bounds read.
|
|
139
|
+
* A silent skip here would leave the permutation subtly unsorted and produce
|
|
140
|
+
* wrong query results, so fail loudly instead.
|
|
141
|
+
*/
|
|
142
|
+
function entityAt(indexes, position) {
|
|
143
|
+
const value = indexes[position];
|
|
144
|
+
if (value === undefined) {
|
|
145
|
+
throw new Error(`Indirect KD index read out of bounds at position ${position}`);
|
|
146
|
+
}
|
|
147
|
+
return value;
|
|
148
|
+
}
|
|
149
|
+
function coordinate(lons, lats, entityIndex, axis) {
|
|
150
|
+
const value = axis === 0 ? lons[entityIndex] : lats[entityIndex];
|
|
151
|
+
if (value === undefined)
|
|
152
|
+
throw new Error(`Missing coordinate for node index ${entityIndex}`);
|
|
153
|
+
return value;
|
|
154
|
+
}
|
|
155
|
+
function compareCoordinate(lons, lats, a, b, axis) {
|
|
156
|
+
return coordinate(lons, lats, a, axis) - coordinate(lons, lats, b, axis);
|
|
157
|
+
}
|
|
158
|
+
function swap(indexes, a, b) {
|
|
159
|
+
const valueA = entityAt(indexes, a);
|
|
160
|
+
indexes[a] = entityAt(indexes, b);
|
|
161
|
+
indexes[b] = valueA;
|
|
162
|
+
}
|
|
163
|
+
//# sourceMappingURL=indirect-kd-index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"indirect-kd-index.js","sourceRoot":"","sources":["../src/indirect-kd-index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAEtD,MAAM,iBAAiB,GAAG,EAAE,CAAC;AAE7B,MAAM,OAAO,eAAe;IACjB,OAAO,CAAc;IACb,IAAI,CAAa;IACjB,IAAI,CAAa;IACjB,QAAQ,CAAS;IAElC,YACE,IAAgB,EAChB,IAAgB,EAChB,OAAoB,EACpB,QAAQ,GAAG,iBAAiB;QAE5B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC3B,CAAC;IAED,MAAM,CAAC,KAAK,CACV,IAAgB,EAChB,IAAgB,EAChB,KAAa,EACb,IAAoC;QAEpC,MAAM,MAAM,GAAG,IAAI,iBAAiB,CAAC,KAAK,GAAG,WAAW,CAAC,iBA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AAE,IAAI,CAAC,CAAC;AAC3E,CAAC;AAED,SAAS,IAAI,CAAC,OAAoB,EAAE,CAAS,EAAE,CAAS;IACtD,MAAM,MAAM,GAAG,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;IACpC,OAAO,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;IAClC,OAAO,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC;AACtB,CAAC"}
|
package/dist/limits.d.ts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hard capacity limits set by the typed-array layout of `Osm` storage.
|
|
3
|
+
*
|
|
4
|
+
* See `docs/limits.md` for the full list, including limits that come from the
|
|
5
|
+
* JavaScript engine rather than from this layout.
|
|
6
|
+
*/
|
|
7
|
+
/** Largest number of node refs one way can hold (`Ways.refCount` is a `Uint16Array`). */
|
|
8
|
+
export declare const MAX_WAY_REFS = 65535;
|
|
9
|
+
/** Largest number of members one relation can hold (`Relations.memberCount` is a `Uint16Array`). */
|
|
10
|
+
export declare const MAX_RELATION_MEMBERS = 65535;
|
|
11
|
+
/** Largest UTF-8 byte length of one string (`StringTable.count` is a `Uint16Array`). */
|
|
12
|
+
export declare const MAX_STRING_BYTES = 65535;
|
|
13
|
+
/**
|
|
14
|
+
* Largest element offset a `Uint32Array` offset column can store. Bounds the total
|
|
15
|
+
* way refs, relation members and string-table bytes in one dataset.
|
|
16
|
+
*/
|
|
17
|
+
export declare const MAX_UINT32_OFFSET = 4294967295;
|
|
18
|
+
/** The storage limit an {@link OsmCapacityError} reports. */
|
|
19
|
+
export type OsmCapacityLimit = "way-refs" | "relation-members" | "string-bytes" | "total-way-refs" | "total-relation-members" | "total-string-bytes";
|
|
20
|
+
/** Thrown when an entity or dataset is larger than the storage layout can hold. */
|
|
21
|
+
export declare class OsmCapacityError extends Error {
|
|
22
|
+
readonly code = "OSM_CAPACITY_EXCEEDED";
|
|
23
|
+
readonly limit: OsmCapacityLimit;
|
|
24
|
+
readonly value: number;
|
|
25
|
+
readonly max: number;
|
|
26
|
+
constructor(limit: OsmCapacityLimit, value: number, max: number, subject: string);
|
|
27
|
+
}
|
|
28
|
+
/** Throw {@link OsmCapacityError} when `value` is above `max`. */
|
|
29
|
+
export declare function assertCapacity(limit: OsmCapacityLimit, value: number, max: number, subject: () => string): void;
|
|
30
|
+
//# sourceMappingURL=limits.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"limits.d.ts","sourceRoot":"","sources":["../src/limits.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,yFAAyF;AACzF,eAAO,MAAM,YAAY,QAAS,CAAC;AAEnC,oGAAoG;AACpG,eAAO,MAAM,oBAAoB,QAAS,CAAC;AAE3C,wFAAwF;AACxF,eAAO,MAAM,gBAAgB,QAAS,CAAC;AAEvC;;;GAGG;AACH,eAAO,MAAM,iBAAiB,aAAa,CAAC;AAE5C,6DAA6D;AAC7D,MAAM,MAAM,gBAAgB,GACxB,UAAU,GACV,kBAAkB,GAClB,cAAc,GACd,gBAAgB,GAChB,wBAAwB,GACxB,oBAAoB,CAAC;AAEzB,mFAAmF;AACnF,qBAAa,gBAAiB,SAAQ,KAAK;IACzC,QAAQ,CAAC,IAAI,2BAA2B;IACxC,QAAQ,CAAC,KAAK,EAAE,gBAAgB,CAAC;IACjC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IAErB,YAAY,KAAK,EAAE,gBAAgB,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAS/E;CACF;AAgBD,kEAAkE;AAClE,wBAAgB,cAAc,CAC5B,KAAK,EAAE,gBAAgB,EACvB,KAAK,EAAE,MAAM,EACb,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,MAAM,MAAM,GACpB,IAAI,CAEN"}
|
package/dist/limits.js
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hard capacity limits set by the typed-array layout of `Osm` storage.
|
|
3
|
+
*
|
|
4
|
+
* See `docs/limits.md` for the full list, including limits that come from the
|
|
5
|
+
* JavaScript engine rather than from this layout.
|
|
6
|
+
*/
|
|
7
|
+
/** Largest number of node refs one way can hold (`Ways.refCount` is a `Uint16Array`). */
|
|
8
|
+
export const MAX_WAY_REFS = 0xffff;
|
|
9
|
+
/** Largest number of members one relation can hold (`Relations.memberCount` is a `Uint16Array`). */
|
|
10
|
+
export const MAX_RELATION_MEMBERS = 0xffff;
|
|
11
|
+
/** Largest UTF-8 byte length of one string (`StringTable.count` is a `Uint16Array`). */
|
|
12
|
+
export const MAX_STRING_BYTES = 0xffff;
|
|
13
|
+
/**
|
|
14
|
+
* Largest element offset a `Uint32Array` offset column can store. Bounds the total
|
|
15
|
+
* way refs, relation members and string-table bytes in one dataset.
|
|
16
|
+
*/
|
|
17
|
+
export const MAX_UINT32_OFFSET = 0xffffffff;
|
|
18
|
+
/** Thrown when an entity or dataset is larger than the storage layout can hold. */
|
|
19
|
+
export class OsmCapacityError extends Error {
|
|
20
|
+
code = "OSM_CAPACITY_EXCEEDED";
|
|
21
|
+
limit;
|
|
22
|
+
value;
|
|
23
|
+
max;
|
|
24
|
+
constructor(limit, value, max, subject) {
|
|
25
|
+
super(`${subject} has ${value.toLocaleString("en-US")} ${capacityUnit(limit)}; ` +
|
|
26
|
+
`Osmix stores at most ${max.toLocaleString("en-US")}.`);
|
|
27
|
+
this.name = "OsmCapacityError";
|
|
28
|
+
this.limit = limit;
|
|
29
|
+
this.value = value;
|
|
30
|
+
this.max = max;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
function capacityUnit(limit) {
|
|
34
|
+
switch (limit) {
|
|
35
|
+
case "way-refs":
|
|
36
|
+
case "total-way-refs":
|
|
37
|
+
return "node refs";
|
|
38
|
+
case "relation-members":
|
|
39
|
+
case "total-relation-members":
|
|
40
|
+
return "members";
|
|
41
|
+
case "string-bytes":
|
|
42
|
+
case "total-string-bytes":
|
|
43
|
+
return "UTF-8 bytes";
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
/** Throw {@link OsmCapacityError} when `value` is above `max`. */
|
|
47
|
+
export function assertCapacity(limit, value, max, subject) {
|
|
48
|
+
if (value > max)
|
|
49
|
+
throw new OsmCapacityError(limit, value, max, subject());
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=limits.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"limits.js","sourceRoot":"","sources":["../src/limits.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,yFAAyF;AACzF,MAAM,CAAC,MAAM,YAAY,GAAG,MAAM,CAAC;AAEnC,oGAAoG;AACpG,MAAM,CAAC,MAAM,oBAAoB,GAAG,MAAM,CAAC;AAE3C,wFAAwF;AACxF,MAAM,CAAC,MAAM,gBAAgB,GAAG,MAAM,CAAC;AAEvC;;;GAGG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,UAAU,CAAC;AAW5C,mFAAmF;AACnF,MAAM,OAAO,gBAAiB,SAAQ,KAAK;IAChC,IAAI,GAAG,uBAAuB,CAAC;IAC/B,KAAK,CAAmB;IACxB,KAAK,CAAS;IACd,GAAG,CAAS;IAErB,YAAY,KAAuB,EAAE,KAAa,EAAE,GAAW,EAAE,OAAe;QAC9E,KAAK,CACH,GAAG,OAAO,QAAQ,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,IAAI,YAAY,CAAC,KAAK,CAAC,IAAI;YACxE,wBAAwB,GAAG,CAAC,cAAc,CAAC,OAAO,CAAC,GAAG,CACzD,CAAC;QACF,IAAI,CAAC,IAAI,GAAG,kBAAkB,CAAC;QAC/B,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;IACjB,CAAC;CACF;AAED,SAAS,YAAY,CAAC,KAAuB;IAC3C,QAAQ,KAAK,EAAE,CAAC;QACd,KAAK,UAAU,CAAC;QAChB,KAAK,gBAAgB;YACnB,OAAO,WAAW,CAAC;QACrB,KAAK,kBAAkB,CAAC;QACxB,KAAK,wBAAwB;YAC3B,OAAO,SAAS,CAAC;QACnB,KAAK,cAAc,CAAC;QACpB,KAAK,oBAAoB;YACvB,OAAO,aAAa,CAAC;IACzB,CAAC;AACH,CAAC;AAED,kEAAkE;AAClE,MAAM,UAAU,cAAc,CAC5B,KAAuB,EACvB,KAAa,EACb,GAAW,EACX,OAAqB;IAErB,IAAI,KAAK,GAAG,GAAG;QAAE,MAAM,IAAI,gBAAgB,CAAC,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,CAAC,CAAC;AAC5E,CAAC"}
|
package/dist/nodes.d.ts
CHANGED
|
@@ -5,12 +5,21 @@ import { Entities, type EntitiesTransferables } from "./entities.ts";
|
|
|
5
5
|
import { type IdOrIndex } from "./ids.ts";
|
|
6
6
|
import type StringTable from "./stringtable.ts";
|
|
7
7
|
import { type BufferType } from "./typed-arrays.ts";
|
|
8
|
+
export type NodeSpatialIndexKind = "all" | "tagged";
|
|
9
|
+
export declare class SpatialIndexNotBuiltError extends Error {
|
|
10
|
+
readonly code = "SPATIAL_INDEX_NOT_BUILT";
|
|
11
|
+
readonly entityType = "node";
|
|
12
|
+
readonly indexKind: NodeSpatialIndexKind;
|
|
13
|
+
constructor(indexKind: NodeSpatialIndexKind);
|
|
14
|
+
}
|
|
8
15
|
export interface NodesTransferables<T extends BufferType = BufferType> extends EntitiesTransferables<T> {
|
|
9
16
|
lons: T;
|
|
10
17
|
lats: T;
|
|
11
18
|
bbox: GeoBbox2D;
|
|
12
|
-
/** Optional - can be rebuilt via buildSpatialIndex() */
|
|
13
|
-
|
|
19
|
+
/** Optional all-node Uint32 permutation; can be rebuilt via buildSpatialIndex("all"). */
|
|
20
|
+
allSpatialIndex?: T;
|
|
21
|
+
/** Optional tagged-node Uint32 permutation; can be rebuilt via buildSpatialIndex("tagged"). */
|
|
22
|
+
taggedSpatialIndex?: T;
|
|
14
23
|
}
|
|
15
24
|
export interface AddNodeOptions {
|
|
16
25
|
filter?: (node: OsmNode) => boolean;
|
|
@@ -23,8 +32,8 @@ export declare class Nodes extends Entities<OsmNode> {
|
|
|
23
32
|
private lons;
|
|
24
33
|
private lats;
|
|
25
34
|
private bbox;
|
|
26
|
-
private
|
|
27
|
-
private
|
|
35
|
+
private allSpatialIndex?;
|
|
36
|
+
private taggedSpatialIndex?;
|
|
28
37
|
/**
|
|
29
38
|
* Create a new Nodes index.
|
|
30
39
|
*/
|
|
@@ -42,18 +51,19 @@ export declare class Nodes extends Entities<OsmNode> {
|
|
|
42
51
|
*/
|
|
43
52
|
buildEntityIndex(): void;
|
|
44
53
|
/**
|
|
45
|
-
* Build the
|
|
46
|
-
* Spatial index stores degrees (Float64Array) for geokdbush compatibility.
|
|
54
|
+
* Build one of the independent node spatial indexes.
|
|
47
55
|
*/
|
|
48
|
-
buildSpatialIndex(): void;
|
|
56
|
+
buildSpatialIndex(kind?: NodeSpatialIndexKind): void;
|
|
49
57
|
/**
|
|
50
58
|
* Check if the spatial index has been built.
|
|
51
59
|
*/
|
|
52
|
-
hasSpatialIndex(): boolean;
|
|
60
|
+
hasSpatialIndex(kind?: NodeSpatialIndexKind): boolean;
|
|
61
|
+
/** Number of nodes that carry at least one tag. */
|
|
62
|
+
get taggedSize(): number;
|
|
53
63
|
/**
|
|
54
|
-
* Get the bounding box of all nodes.
|
|
64
|
+
* Get the bounding box of all nodes, or `null` when there are no nodes.
|
|
55
65
|
*/
|
|
56
|
-
getBbox(): GeoBbox2D;
|
|
66
|
+
getBbox(): GeoBbox2D | null;
|
|
57
67
|
/**
|
|
58
68
|
* Get the bounding box of a specific node.
|
|
59
69
|
*/
|
|
@@ -76,9 +86,11 @@ export declare class Nodes extends Entities<OsmNode> {
|
|
|
76
86
|
* Find node indexes within a bounding box.
|
|
77
87
|
*/
|
|
78
88
|
findIndexesWithinBbox(bbox: GeoBbox2D): number[];
|
|
89
|
+
/** Find tagged node indexes within a bounding box. */
|
|
90
|
+
findTaggedIndexesWithinBbox(bbox: GeoBbox2D): number[];
|
|
79
91
|
/**
|
|
80
92
|
* Find node indexes within a radius of a point.
|
|
81
|
-
* Uses
|
|
93
|
+
* Uses an exact haversine-distance filter over a conservative KD bbox query.
|
|
82
94
|
* @param lon - Longitude in degrees.
|
|
83
95
|
* @param lat - Latitude in degrees.
|
|
84
96
|
* @param radiusKm - Radius in kilometers.
|
|
@@ -97,16 +109,19 @@ export declare class Nodes extends Entities<OsmNode> {
|
|
|
97
109
|
};
|
|
98
110
|
/**
|
|
99
111
|
* Get transferable objects for passing to another thread.
|
|
100
|
-
* Only includes
|
|
112
|
+
* Only includes spatial indexes that have been built.
|
|
101
113
|
*/
|
|
102
114
|
transferables(): NodesTransferables;
|
|
103
115
|
/**
|
|
104
116
|
* Get the approximate memory requirements for a given number of nodes in bytes.
|
|
105
117
|
*/
|
|
106
|
-
static getBytesRequired(count: number): number;
|
|
118
|
+
static getBytesRequired(count: number, taggedCount?: number, tagCount?: number): number;
|
|
119
|
+
/** Exact bytes in an indirect node spatial-index permutation. */
|
|
120
|
+
static getSpatialIndexBytesRequired(count: number): number;
|
|
107
121
|
/**
|
|
108
122
|
* Update a ContentHasher with node-specific data (coordinates).
|
|
109
123
|
*/
|
|
110
124
|
updateHash(hasher: ContentHasher): ContentHasher;
|
|
125
|
+
private getSpatialIndex;
|
|
111
126
|
}
|
|
112
127
|
//# sourceMappingURL=nodes.d.ts.map
|
package/dist/nodes.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nodes.d.ts","sourceRoot":"","sources":["../src/nodes.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC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