@osmix/core 0.0.2 → 0.1.1
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 +60 -0
- package/README.md +118 -107
- package/dist/src/entities.d.ts +103 -9
- package/dist/src/entities.d.ts.map +1 -1
- package/dist/src/entities.js +101 -11
- package/dist/src/entities.js.map +1 -1
- package/dist/src/ids.d.ts +82 -13
- package/dist/src/ids.d.ts.map +1 -1
- package/dist/src/ids.js +103 -31
- package/dist/src/ids.js.map +1 -1
- package/dist/src/index.d.ts +31 -5
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +33 -5
- package/dist/src/index.js.map +1 -1
- package/dist/src/nodes.d.ts +91 -21
- package/dist/src/nodes.d.ts.map +1 -1
- package/dist/src/nodes.js +191 -44
- package/dist/src/nodes.js.map +1 -1
- package/dist/src/osm.d.ts +99 -0
- package/dist/src/osm.d.ts.map +1 -0
- package/dist/src/osm.js +165 -0
- package/dist/src/osm.js.map +1 -0
- package/dist/src/relations.d.ts +112 -20
- package/dist/src/relations.d.ts.map +1 -1
- package/dist/src/relations.js +298 -35
- package/dist/src/relations.js.map +1 -1
- package/dist/src/stringtable.d.ts +78 -14
- package/dist/src/stringtable.d.ts.map +1 -1
- package/dist/src/stringtable.js +105 -26
- package/dist/src/stringtable.js.map +1 -1
- package/dist/src/tags.d.ts +117 -18
- package/dist/src/tags.d.ts.map +1 -1
- package/dist/src/tags.js +177 -30
- package/dist/src/tags.js.map +1 -1
- package/dist/src/typed-arrays.d.ts +85 -11
- package/dist/src/typed-arrays.d.ts.map +1 -1
- package/dist/src/typed-arrays.js +88 -9
- package/dist/src/typed-arrays.js.map +1 -1
- package/dist/src/utils.d.ts +35 -1
- package/dist/src/utils.d.ts.map +1 -1
- package/dist/src/utils.js +69 -10
- package/dist/src/utils.js.map +1 -1
- package/dist/src/ways.d.ts +91 -27
- package/dist/src/ways.d.ts.map +1 -1
- package/dist/src/ways.js +229 -69
- package/dist/src/ways.js.map +1 -1
- package/dist/test/memory.test.d.ts +7 -0
- package/dist/test/memory.test.d.ts.map +1 -0
- package/dist/test/memory.test.js +29 -0
- package/dist/test/memory.test.js.map +1 -0
- package/dist/test/mock-osm.d.ts +3 -3
- package/dist/test/mock-osm.d.ts.map +1 -1
- package/dist/test/mock-osm.js +3 -3
- package/dist/test/mock-osm.js.map +1 -1
- package/dist/test/tags-search.test.d.ts +2 -0
- package/dist/test/tags-search.test.d.ts.map +1 -0
- package/dist/test/tags-search.test.js +56 -0
- package/dist/test/tags-search.test.js.map +1 -0
- package/dist/test/typed-arrays.test.js +19 -17
- package/dist/test/typed-arrays.test.js.map +1 -1
- package/package.json +11 -13
- package/src/entities.ts +147 -22
- package/src/ids.ts +126 -45
- package/src/index.ts +34 -5
- package/src/nodes.ts +248 -58
- package/src/osm.ts +222 -0
- package/src/relations.ts +396 -54
- package/src/stringtable.ts +123 -36
- package/src/tags.ts +220 -46
- package/src/typed-arrays.ts +97 -10
- package/src/types/geoflatbush.d.ts +37 -0
- package/src/types/geokdbush.d.ts +37 -0
- package/src/types/kdbush.d.ts +24 -6
- package/src/utils.ts +80 -14
- package/src/ways.ts +260 -84
- package/test/memory.test.ts +38 -0
- package/test/mock-osm.ts +8 -8
- package/test/tags-search.test.ts +60 -0
- package/test/typed-arrays.test.ts +5 -6
- package/dist/src/osmix.d.ts +0 -88
- package/dist/src/osmix.d.ts.map +0 -1
- package/dist/src/osmix.js +0 -438
- package/dist/src/osmix.js.map +0 -1
- package/dist/test/extract.bench.d.ts +0 -2
- package/dist/test/extract.bench.d.ts.map +0 -1
- package/dist/test/extract.bench.js +0 -23
- package/dist/test/extract.bench.js.map +0 -1
- package/dist/test/extract.test.d.ts +0 -2
- package/dist/test/extract.test.d.ts.map +0 -1
- package/dist/test/extract.test.js +0 -127
- package/dist/test/extract.test.js.map +0 -1
- package/dist/test/read.test.d.ts +0 -2
- package/dist/test/read.test.d.ts.map +0 -1
- package/dist/test/read.test.js +0 -17
- package/dist/test/read.test.js.map +0 -1
- package/dist/test/write.test.d.ts +0 -2
- package/dist/test/write.test.d.ts.map +0 -1
- package/dist/test/write.test.js +0 -55
- package/dist/test/write.test.js.map +0 -1
- package/src/osmix.ts +0 -556
- package/test/extract.bench.ts +0 -29
- package/test/extract.test.ts +0 -161
- package/test/read.test.ts +0 -22
- package/test/write.test.ts +0 -69
package/dist/src/nodes.js
CHANGED
|
@@ -1,49 +1,62 @@
|
|
|
1
1
|
import { assertValue } from "@osmix/shared/assert";
|
|
2
|
+
import { microToDegrees, toMicroDegrees } from "@osmix/shared/coordinates";
|
|
3
|
+
import { around as geoAround } from "geokdbush";
|
|
2
4
|
import KDBush from "kdbush";
|
|
3
5
|
import { Entities } from "./entities";
|
|
4
6
|
import { Ids } from "./ids";
|
|
5
7
|
import { Tags } from "./tags";
|
|
6
|
-
import { BufferConstructor,
|
|
8
|
+
import { BufferConstructor, ResizeableTypedArray as RTA, } from "./typed-arrays";
|
|
7
9
|
export class Nodes extends Entities {
|
|
10
|
+
/**
|
|
11
|
+
* Coordinates are stored as integer microdegrees (Int32Array).
|
|
12
|
+
* Use OSM_COORD_SCALE (1e7) to convert between degrees and microdegrees.
|
|
13
|
+
*/
|
|
8
14
|
lons;
|
|
9
15
|
lats;
|
|
16
|
+
// Bbox stored in microdegrees internally
|
|
10
17
|
bbox = [
|
|
11
|
-
Number.
|
|
12
|
-
Number.
|
|
13
|
-
Number.
|
|
14
|
-
Number.
|
|
18
|
+
Number.MAX_SAFE_INTEGER,
|
|
19
|
+
Number.MAX_SAFE_INTEGER,
|
|
20
|
+
Number.MIN_SAFE_INTEGER,
|
|
21
|
+
Number.MIN_SAFE_INTEGER,
|
|
15
22
|
];
|
|
23
|
+
// Spatial index stores coordinates in degrees (Float64Array) for geokdbush compatibility
|
|
16
24
|
spatialIndex = new KDBush(0, 128, Float64Array, BufferConstructor);
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
25
|
+
// Track if spatial index was properly built (vs default empty)
|
|
26
|
+
spatialIndexBuilt = false;
|
|
27
|
+
/**
|
|
28
|
+
* Create a new Nodes index.
|
|
29
|
+
*/
|
|
30
|
+
constructor(stringTable, transferables) {
|
|
31
|
+
if (transferables) {
|
|
32
|
+
super("node", new Ids(transferables), new Tags(stringTable, transferables));
|
|
33
|
+
this.lons = RTA.from(Int32Array, transferables.lons);
|
|
34
|
+
this.lats = RTA.from(Int32Array, transferables.lats);
|
|
35
|
+
// Only load spatial index if provided (not stored in IndexedDB)
|
|
36
|
+
if (transferables.spatialIndex?.byteLength) {
|
|
37
|
+
this.spatialIndex = KDBush.from(transferables.spatialIndex);
|
|
38
|
+
this.spatialIndexBuilt = true;
|
|
39
|
+
}
|
|
40
|
+
this.bbox = transferables.bbox;
|
|
41
|
+
this.indexBuilt = true;
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
super("node", new Ids(), new Tags(stringTable));
|
|
45
|
+
this.lons = new RTA(Int32Array);
|
|
46
|
+
this.lats = new RTA(Int32Array);
|
|
47
|
+
// Spatial index uses Float64Array with degrees for geokdbush compatibility
|
|
48
|
+
this.spatialIndex = new KDBush(0, 128, Float64Array, BufferConstructor);
|
|
49
|
+
}
|
|
41
50
|
}
|
|
51
|
+
/**
|
|
52
|
+
* Add a single node to the index.
|
|
53
|
+
*/
|
|
42
54
|
addNode(node) {
|
|
43
|
-
this.
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
this.
|
|
55
|
+
const nodeIndex = this.addEntity(node.id, node.tags ?? {});
|
|
56
|
+
const lonMicro = toMicroDegrees(node.lon);
|
|
57
|
+
const latMicro = toMicroDegrees(node.lat);
|
|
58
|
+
this.lons.push(lonMicro);
|
|
59
|
+
this.lats.push(latMicro);
|
|
47
60
|
if (node.lon < this.bbox[0])
|
|
48
61
|
this.bbox[0] = node.lon;
|
|
49
62
|
if (node.lat < this.bbox[1])
|
|
@@ -52,8 +65,13 @@ export class Nodes extends Entities {
|
|
|
52
65
|
this.bbox[2] = node.lon;
|
|
53
66
|
if (node.lat > this.bbox[3])
|
|
54
67
|
this.bbox[3] = node.lat;
|
|
68
|
+
return nodeIndex;
|
|
55
69
|
}
|
|
70
|
+
/**
|
|
71
|
+
* Add dense nodes from a PBF block.
|
|
72
|
+
*/
|
|
56
73
|
addDenseNodes(dense, block, blockStringIndexMap, filter) {
|
|
74
|
+
// PBF block already has offsets and granularity converted to degrees
|
|
57
75
|
const lon_offset = block.lon_offset ?? 0;
|
|
58
76
|
const lat_offset = block.lat_offset ?? 0;
|
|
59
77
|
const granularity = block.granularity ?? 1e7;
|
|
@@ -69,7 +87,7 @@ export class Nodes extends Entities {
|
|
|
69
87
|
const getStringTableIndex = (keyIndex) => {
|
|
70
88
|
const key = dense.keys_vals[keyIndex];
|
|
71
89
|
assertValue(key, "Block string key is undefined");
|
|
72
|
-
const index = blockStringIndexMap
|
|
90
|
+
const index = blockStringIndexMap[key];
|
|
73
91
|
assertValue(index, "Block string not found");
|
|
74
92
|
return index;
|
|
75
93
|
};
|
|
@@ -85,8 +103,12 @@ export class Nodes extends Entities {
|
|
|
85
103
|
delta.id += idSid;
|
|
86
104
|
delta.lat += latSid;
|
|
87
105
|
delta.lon += lonSid;
|
|
106
|
+
// Calculate degrees from PBF delta encoding
|
|
88
107
|
const lon = lon_offset + delta.lon / granularity;
|
|
89
108
|
const lat = lat_offset + delta.lat / granularity;
|
|
109
|
+
// Convert to microdegrees for storage
|
|
110
|
+
const lonMicro = toMicroDegrees(lon);
|
|
111
|
+
const latMicro = toMicroDegrees(lat);
|
|
90
112
|
const tagKeys = [];
|
|
91
113
|
const tagValues = [];
|
|
92
114
|
if (dense.keys_vals.length > 0) {
|
|
@@ -111,9 +133,9 @@ export class Nodes extends Entities {
|
|
|
111
133
|
: true;
|
|
112
134
|
if (!shouldInclude)
|
|
113
135
|
continue;
|
|
114
|
-
this.
|
|
115
|
-
this.lons.push(
|
|
116
|
-
this.lats.push(
|
|
136
|
+
this.addEntity(delta.id, tagKeys, tagValues);
|
|
137
|
+
this.lons.push(lonMicro);
|
|
138
|
+
this.lats.push(latMicro);
|
|
117
139
|
if (lon < this.bbox[0])
|
|
118
140
|
this.bbox[0] = lon;
|
|
119
141
|
if (lat < this.bbox[1])
|
|
@@ -122,28 +144,69 @@ export class Nodes extends Entities {
|
|
|
122
144
|
this.bbox[2] = lon;
|
|
123
145
|
if (lat > this.bbox[3])
|
|
124
146
|
this.bbox[3] = lat;
|
|
125
|
-
this.tags.addTagKeysAndValues(tagKeys, tagValues);
|
|
126
147
|
added++;
|
|
127
148
|
}
|
|
128
149
|
return added;
|
|
129
150
|
}
|
|
151
|
+
/**
|
|
152
|
+
* Compact the internal arrays to free up memory.
|
|
153
|
+
*/
|
|
130
154
|
buildEntityIndex() {
|
|
131
155
|
this.lons.compact();
|
|
132
156
|
this.lats.compact();
|
|
133
157
|
}
|
|
158
|
+
/**
|
|
159
|
+
* Build the spatial index for nodes.
|
|
160
|
+
* Spatial index stores degrees (Float64Array) for geokdbush compatibility.
|
|
161
|
+
*/
|
|
134
162
|
buildSpatialIndex() {
|
|
135
163
|
console.time("NodeIndex.buildSpatialIndex");
|
|
136
|
-
|
|
164
|
+
// Use Float64Array with degrees for geokdbush geographic queries
|
|
165
|
+
this.spatialIndex = new KDBush(this.size, 64, Float64Array, BufferConstructor);
|
|
137
166
|
for (let i = 0; i < this.size; i++) {
|
|
138
|
-
|
|
167
|
+
// Convert microdegrees to degrees for spatial index
|
|
168
|
+
const lon = microToDegrees(this.lons.at(i));
|
|
169
|
+
const lat = microToDegrees(this.lats.at(i));
|
|
170
|
+
this.spatialIndex.add(lon, lat);
|
|
139
171
|
}
|
|
140
172
|
this.spatialIndex.finish();
|
|
173
|
+
this.spatialIndexBuilt = true;
|
|
141
174
|
console.timeEnd("NodeIndex.buildSpatialIndex");
|
|
142
175
|
}
|
|
176
|
+
/**
|
|
177
|
+
* Check if the spatial index has been built.
|
|
178
|
+
*/
|
|
179
|
+
hasSpatialIndex() {
|
|
180
|
+
return this.spatialIndexBuilt;
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Get the bounding box of all nodes.
|
|
184
|
+
*/
|
|
185
|
+
getBbox() {
|
|
186
|
+
return this.bbox;
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Get the bounding box of a specific node.
|
|
190
|
+
*/
|
|
191
|
+
getEntityBbox(i) {
|
|
192
|
+
const index = "index" in i ? i.index : this.ids.idOrIndex(i)[0];
|
|
193
|
+
const lon = microToDegrees(this.lons.at(index));
|
|
194
|
+
const lat = microToDegrees(this.lats.at(index));
|
|
195
|
+
return [lon, lat, lon, lat];
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Get the longitude and latitude of a specific node.
|
|
199
|
+
*/
|
|
143
200
|
getNodeLonLat(i) {
|
|
144
201
|
const index = "index" in i ? i.index : this.ids.idOrIndex(i)[0];
|
|
145
|
-
return [
|
|
202
|
+
return [
|
|
203
|
+
microToDegrees(this.lons.at(index)),
|
|
204
|
+
microToDegrees(this.lats.at(index)),
|
|
205
|
+
];
|
|
146
206
|
}
|
|
207
|
+
/**
|
|
208
|
+
* Get the full node entity.
|
|
209
|
+
*/
|
|
147
210
|
getFullEntity(index, id, tags) {
|
|
148
211
|
const [lon, lat] = this.getNodeLonLat({ index });
|
|
149
212
|
if (tags) {
|
|
@@ -161,11 +224,95 @@ export class Nodes extends Entities {
|
|
|
161
224
|
};
|
|
162
225
|
}
|
|
163
226
|
// Spatial operations
|
|
164
|
-
|
|
227
|
+
/**
|
|
228
|
+
* Find node indexes within a bounding box.
|
|
229
|
+
*/
|
|
230
|
+
findIndexesWithinBbox(bbox) {
|
|
231
|
+
// Spatial index stores degrees, so query with degrees directly
|
|
165
232
|
return this.spatialIndex.range(bbox[0], bbox[1], bbox[2], bbox[3]);
|
|
166
233
|
}
|
|
167
|
-
|
|
168
|
-
|
|
234
|
+
/**
|
|
235
|
+
* Find node indexes within a radius of a point.
|
|
236
|
+
* Uses geokdbush for proper great-circle distance calculations.
|
|
237
|
+
* @param lon - Longitude in degrees.
|
|
238
|
+
* @param lat - Latitude in degrees.
|
|
239
|
+
* @param radiusKm - Radius in kilometers.
|
|
240
|
+
* @returns Array of node indexes within the radius.
|
|
241
|
+
*/
|
|
242
|
+
findIndexesWithinRadius(lon, lat, radiusKm) {
|
|
243
|
+
// Use geokdbush for proper geographic distance calculations
|
|
244
|
+
return geoAround(this.spatialIndex, lon, lat, Number.POSITIVE_INFINITY, radiusKm);
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* Get nodes within a bounding box.
|
|
248
|
+
* @param bbox - The bounding box to search within.
|
|
249
|
+
* @param include - A function to filter nodes. If provided, only nodes for which the function returns true will be included.
|
|
250
|
+
* @returns An object containing the IDs and positions of the nodes within the bounding box.
|
|
251
|
+
*/
|
|
252
|
+
withinBbox(bbox, include) {
|
|
253
|
+
console.time("Nodes.withinBbox");
|
|
254
|
+
const nodeCandidates = this.findIndexesWithinBbox(bbox);
|
|
255
|
+
const nodePositions = new Float64Array(nodeCandidates.length * 2);
|
|
256
|
+
const ids = new Float64Array(nodeCandidates.length);
|
|
257
|
+
let skipped = 0;
|
|
258
|
+
nodeCandidates.forEach((nodeIndex, i) => {
|
|
259
|
+
if (include && !include(nodeIndex)) {
|
|
260
|
+
skipped++;
|
|
261
|
+
return;
|
|
262
|
+
}
|
|
263
|
+
const [lon, lat] = this.getNodeLonLat({ index: nodeIndex });
|
|
264
|
+
ids[i - skipped] = this.ids.at(nodeIndex);
|
|
265
|
+
nodePositions[(i - skipped) * 2] = lon;
|
|
266
|
+
nodePositions[(i - skipped) * 2 + 1] = lat;
|
|
267
|
+
});
|
|
268
|
+
console.timeEnd("Nodes.withinBbox");
|
|
269
|
+
return {
|
|
270
|
+
ids: ids.subarray(0, nodeCandidates.length - skipped),
|
|
271
|
+
positions: nodePositions.slice(0, (nodeCandidates.length - skipped) * 2),
|
|
272
|
+
};
|
|
273
|
+
}
|
|
274
|
+
/**
|
|
275
|
+
* Get transferable objects for passing to another thread.
|
|
276
|
+
* Only includes spatialIndex if it has been built.
|
|
277
|
+
*/
|
|
278
|
+
transferables() {
|
|
279
|
+
const base = {
|
|
280
|
+
...super.transferables(),
|
|
281
|
+
lons: this.lons.array.buffer,
|
|
282
|
+
lats: this.lats.array.buffer,
|
|
283
|
+
bbox: this.bbox,
|
|
284
|
+
};
|
|
285
|
+
// Only include spatial index if it was built
|
|
286
|
+
if (this.spatialIndexBuilt) {
|
|
287
|
+
return { ...base, spatialIndex: this.spatialIndex.data };
|
|
288
|
+
}
|
|
289
|
+
return base;
|
|
290
|
+
}
|
|
291
|
+
/**
|
|
292
|
+
* Get the approximate memory requirements for a given number of nodes in bytes.
|
|
293
|
+
*/
|
|
294
|
+
static getBytesRequired(count) {
|
|
295
|
+
if (count === 0)
|
|
296
|
+
return 0;
|
|
297
|
+
const indexBytes = (count < 65536 ? 2 : 4) * count;
|
|
298
|
+
// Spatial index stores coordinates in degrees (Float64Array)
|
|
299
|
+
const coordsBytes = count * 2 * Float64Array.BYTES_PER_ELEMENT;
|
|
300
|
+
const padding = (8 - (indexBytes % 8)) % 8;
|
|
301
|
+
const spatialIndexBytes = 8 + indexBytes + coordsBytes + padding;
|
|
302
|
+
return (Ids.getBytesRequired(count) +
|
|
303
|
+
Tags.getBytesRequired(count) +
|
|
304
|
+
count * Int32Array.BYTES_PER_ELEMENT + // lons (stored in microdegrees)
|
|
305
|
+
count * Int32Array.BYTES_PER_ELEMENT + // lats (stored in microdegrees)
|
|
306
|
+
spatialIndexBytes);
|
|
307
|
+
}
|
|
308
|
+
/**
|
|
309
|
+
* Update a ContentHasher with node-specific data (coordinates).
|
|
310
|
+
*/
|
|
311
|
+
updateHash(hasher) {
|
|
312
|
+
return super
|
|
313
|
+
.updateHash(hasher)
|
|
314
|
+
.update(this.lons.array)
|
|
315
|
+
.update(this.lats.array);
|
|
169
316
|
}
|
|
170
317
|
}
|
|
171
318
|
//# sourceMappingURL=nodes.js.map
|
package/dist/src/nodes.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nodes.js","sourceRoot":"","sources":["../../src/nodes.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;AAElD,OAAO,MAAM,MAAM,QAAQ,CAAA;AAC3B,OAAO,EAAE,QAAQ,EAA8B,MAAM,YAAY,CAAA;AACjE,OAAO,EAAkB,GAAG,EAAE,MAAM,OAAO,CAAA;AAE3C,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAC7B,OAAO,EACN,iBAAiB,EAEjB,mBAAmB,EACnB,oBAAoB,GACpB,MAAM,gBAAgB,CAAA;AAavB,MAAM,OAAO,KAAM,SAAQ,QAAiB;IAC3C,IAAI,CAAoC;IACxC,IAAI,CAAoC;IACxC,IAAI,GAAc;QACjB,MAAM,CAAC,iBAAiB;QACxB,MAAM,CAAC,iBAAiB;QACxB,MAAM,CAAC,iBAAiB;QACxB,MAAM,CAAC,iBAAiB;KACxB,CAAA;IACD,YAAY,GAAW,IAAI,MAAM,CAAC,CAAC,EAAE,GAAG,EAAE,YAAY,EAAE,iBAAiB,CAAC,CAAA;IAE1E,MAAM,CAAC,IAAI,CAAC,WAAwB,EAAE,IAAwB;QAC7D,MAAM,OAAO,GAAG,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QAC9B,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,CAAA;QAC7C,MAAM,SAAS,GAAG,IA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C;YACvE,iBAAiB,CACjB,CAAA;IACF,CAAC;IAED;;OAEG;IACM,UAAU,CAAC,MAAqB;QACxC,OAAO,KAAK;aACV,UAAU,CAAC,MAAM,CAAC;aAClB,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC;aACvB,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;IAC1B,CAAC;CACD"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import type { OsmPbfHeaderBlock } from "@osmix/pbf";
|
|
2
|
+
import type { GeoBbox2D } from "@osmix/shared/types";
|
|
3
|
+
import { Nodes, type NodesTransferables } from "./nodes";
|
|
4
|
+
import { Relations, type RelationsTransferables } from "./relations";
|
|
5
|
+
import StringTable, { type StringTableTransferables } from "./stringtable";
|
|
6
|
+
import type { BufferType } from "./typed-arrays";
|
|
7
|
+
import { Ways, type WaysTransferables } from "./ways";
|
|
8
|
+
export interface OsmTransferables<T extends BufferType = BufferType> {
|
|
9
|
+
id: string;
|
|
10
|
+
header: OsmPbfHeaderBlock;
|
|
11
|
+
contentHash: string;
|
|
12
|
+
stringTable: StringTableTransferables<T>;
|
|
13
|
+
nodes: NodesTransferables<T>;
|
|
14
|
+
ways: WaysTransferables<T>;
|
|
15
|
+
relations: RelationsTransferables<T>;
|
|
16
|
+
}
|
|
17
|
+
export interface OsmInfo {
|
|
18
|
+
id: string;
|
|
19
|
+
bbox: GeoBbox2D;
|
|
20
|
+
header: OsmPbfHeaderBlock;
|
|
21
|
+
stats: {
|
|
22
|
+
nodes: number;
|
|
23
|
+
ways: number;
|
|
24
|
+
relations: number;
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
export interface OsmOptions {
|
|
28
|
+
id: string;
|
|
29
|
+
header: OsmPbfHeaderBlock;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* OSM Entity Index.
|
|
33
|
+
*/
|
|
34
|
+
export declare class Osm {
|
|
35
|
+
readonly id: string;
|
|
36
|
+
readonly header: OsmPbfHeaderBlock;
|
|
37
|
+
readonly stringTable: StringTable;
|
|
38
|
+
readonly nodes: Nodes;
|
|
39
|
+
readonly ways: Ways;
|
|
40
|
+
readonly relations: Relations;
|
|
41
|
+
private indexBuilt;
|
|
42
|
+
private _contentHash;
|
|
43
|
+
/**
|
|
44
|
+
* Create a new OSM Entity index.
|
|
45
|
+
*/
|
|
46
|
+
constructor(opts?: Partial<OsmOptions> | OsmTransferables | Osm);
|
|
47
|
+
/**
|
|
48
|
+
* Build the internal indexes for all entities.
|
|
49
|
+
* Also computes the content hash after indexes are built.
|
|
50
|
+
*/
|
|
51
|
+
buildIndexes(): void;
|
|
52
|
+
/**
|
|
53
|
+
* Check if the index is built and ready for use.
|
|
54
|
+
*/
|
|
55
|
+
isReady(): boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Build spatial indexes for all entities.
|
|
58
|
+
*/
|
|
59
|
+
buildSpatialIndexes(): void;
|
|
60
|
+
/**
|
|
61
|
+
* Check if spatial indexes have been built for all entity types.
|
|
62
|
+
*/
|
|
63
|
+
hasSpatialIndexes(): boolean;
|
|
64
|
+
/**
|
|
65
|
+
* Get the bounding box of all entities in the OSM index.
|
|
66
|
+
*/
|
|
67
|
+
bbox(): GeoBbox2D;
|
|
68
|
+
/**
|
|
69
|
+
* Get information about the OSM index.
|
|
70
|
+
*/
|
|
71
|
+
info(): OsmInfo;
|
|
72
|
+
/**
|
|
73
|
+
* Get transferable objects for passing to another thread.
|
|
74
|
+
*/
|
|
75
|
+
transferables(): OsmTransferables;
|
|
76
|
+
/**
|
|
77
|
+
* Get the content hash of this OSM dataset.
|
|
78
|
+
* The hash is computed when indexes are built.
|
|
79
|
+
*
|
|
80
|
+
* @returns A hex string hash uniquely identifying the content.
|
|
81
|
+
*/
|
|
82
|
+
contentHash(): string;
|
|
83
|
+
/**
|
|
84
|
+
* Check if this OSM dataset has identical content to another.
|
|
85
|
+
* Uses the pre-computed content hash for fast comparison.
|
|
86
|
+
*
|
|
87
|
+
* @param other - The other Osm instance to compare with.
|
|
88
|
+
* @returns True if both datasets have identical content.
|
|
89
|
+
*/
|
|
90
|
+
isEqual(other: Osm | null | undefined): boolean;
|
|
91
|
+
/**
|
|
92
|
+
* Compute a content hash of all underlying data.
|
|
93
|
+
* This hash uniquely identifies the dataset content regardless of metadata.
|
|
94
|
+
*
|
|
95
|
+
* @returns A hex string hash of the content.
|
|
96
|
+
*/
|
|
97
|
+
private computeContentHash;
|
|
98
|
+
}
|
|
99
|
+
//# sourceMappingURL=osm.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"osm.d.ts","sourceRoot":"","sources":["../../src/osm.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAA;AACnD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AACpD,OAAO,EAAE,KAAK,EAAE,KAAK,kBAAkB,EAAE,MAAM,SAAS,CAAA;AACxD,OAAO,EAAE,SAAS,EAAE,KAAK,sBAAsB,EAAE,MAAM,aAAa,CAAA;AACpE,OAAO,WAAW,EAAE,EAAE,KAAK,wBAAwB,EAAE,MAAM,eAAe,CAAA;AAC1E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAEhD,OAAO,EAAE,IAAI,EAAE,KAAK,iBAAiB,EAAE,MAAM,QAAQ,CAAA;AAErD,MAAM,WAAW,gBAAgB,CAAC,CAAC,SAAS,UAAU,GAAG,UAAU;IAClE,EAAE,EAAE,MAAM,CAAA;IACV,MAAM,EAAE,iBAAiB,CAAA;IACzB,WAAW,EAAE,MAAM,CAAA;IACnB,WAAW,EAAE,wBAAwB,CAAC,CAAC,CAAC,CAAA;IACxC,KAAK,EAAE,kBAAkB,CAAC,CAAC,CAAC,CAAA;IAC5B,IAAI,EAAE,iBAAiB,CAAC,CAAC,CAAC,CAAA;IAC1B,SAAS,EAAE,sBAAsB,CAA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
ADDED
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import { Nodes } from "./nodes";
|
|
2
|
+
import { Relations } from "./relations";
|
|
3
|
+
import StringTable, {} from "./stringtable";
|
|
4
|
+
import { ContentHasher } from "./utils";
|
|
5
|
+
import { Ways } from "./ways";
|
|
6
|
+
/**
|
|
7
|
+
* OSM Entity Index.
|
|
8
|
+
*/
|
|
9
|
+
export class Osm {
|
|
10
|
+
// Filename or ID of this OSM Entity index.
|
|
11
|
+
id;
|
|
12
|
+
header;
|
|
13
|
+
// Shared string lookup table for all nodes, ways, and relations
|
|
14
|
+
stringTable;
|
|
15
|
+
nodes;
|
|
16
|
+
ways;
|
|
17
|
+
relations;
|
|
18
|
+
indexBuilt = false;
|
|
19
|
+
_contentHash = "";
|
|
20
|
+
/**
|
|
21
|
+
* Create a new OSM Entity index.
|
|
22
|
+
*/
|
|
23
|
+
constructor(opts) {
|
|
24
|
+
this.id = opts?.id ?? "unknown";
|
|
25
|
+
this.header = opts?.header ?? {
|
|
26
|
+
required_features: [],
|
|
27
|
+
optional_features: [],
|
|
28
|
+
};
|
|
29
|
+
if (opts && "stringTable" in opts) {
|
|
30
|
+
if (opts instanceof Osm) {
|
|
31
|
+
this.stringTable = new StringTable(opts.stringTable.transferables());
|
|
32
|
+
this.nodes = new Nodes(this.stringTable, opts.nodes.transferables());
|
|
33
|
+
this.ways = new Ways(this.stringTable, this.nodes, opts.ways.transferables());
|
|
34
|
+
this.relations = new Relations(this.stringTable, this.nodes, this.ways, opts.relations.transferables());
|
|
35
|
+
this._contentHash = opts._contentHash;
|
|
36
|
+
this.indexBuilt = true;
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
this.stringTable = new StringTable(opts.stringTable);
|
|
40
|
+
this.nodes = new Nodes(this.stringTable, opts.nodes);
|
|
41
|
+
this.ways = new Ways(this.stringTable, this.nodes, opts.ways);
|
|
42
|
+
this.relations = new Relations(this.stringTable, this.nodes, this.ways, opts.relations);
|
|
43
|
+
this._contentHash = opts.contentHash;
|
|
44
|
+
this.indexBuilt = true;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
this.stringTable = new StringTable();
|
|
49
|
+
this.nodes = new Nodes(this.stringTable);
|
|
50
|
+
this.ways = new Ways(this.stringTable, this.nodes);
|
|
51
|
+
this.relations = new Relations(this.stringTable, this.nodes, this.ways);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Build the internal indexes for all entities.
|
|
56
|
+
* Also computes the content hash after indexes are built.
|
|
57
|
+
*/
|
|
58
|
+
buildIndexes() {
|
|
59
|
+
this.stringTable.buildIndex();
|
|
60
|
+
this.nodes.buildIndex();
|
|
61
|
+
this.ways.buildIndex();
|
|
62
|
+
this.relations.buildIndex();
|
|
63
|
+
this.indexBuilt = true;
|
|
64
|
+
// Compute content hash after indexes are built
|
|
65
|
+
this._contentHash = this.computeContentHash();
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Check if the index is built and ready for use.
|
|
69
|
+
*/
|
|
70
|
+
isReady() {
|
|
71
|
+
return (this.nodes.isReady() &&
|
|
72
|
+
this.ways.isReady() &&
|
|
73
|
+
this.relations.isReady() &&
|
|
74
|
+
this.indexBuilt);
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Build spatial indexes for all entities.
|
|
78
|
+
*/
|
|
79
|
+
buildSpatialIndexes() {
|
|
80
|
+
this.nodes.buildSpatialIndex();
|
|
81
|
+
this.ways.buildSpatialIndex();
|
|
82
|
+
this.relations.buildSpatialIndex();
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Check if spatial indexes have been built for all entity types.
|
|
86
|
+
*/
|
|
87
|
+
hasSpatialIndexes() {
|
|
88
|
+
return (this.nodes.hasSpatialIndex() &&
|
|
89
|
+
this.ways.hasSpatialIndex() &&
|
|
90
|
+
this.relations.hasSpatialIndex());
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Get the bounding box of all entities in the OSM index.
|
|
94
|
+
*/
|
|
95
|
+
bbox() {
|
|
96
|
+
return this.nodes.getBbox();
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Get information about the OSM index.
|
|
100
|
+
*/
|
|
101
|
+
info() {
|
|
102
|
+
return {
|
|
103
|
+
id: this.id,
|
|
104
|
+
bbox: this.bbox(),
|
|
105
|
+
header: this.header,
|
|
106
|
+
stats: {
|
|
107
|
+
nodes: this.nodes.size,
|
|
108
|
+
ways: this.ways.size,
|
|
109
|
+
relations: this.relations.size,
|
|
110
|
+
},
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Get transferable objects for passing to another thread.
|
|
115
|
+
*/
|
|
116
|
+
transferables() {
|
|
117
|
+
return {
|
|
118
|
+
id: this.id,
|
|
119
|
+
header: this.header,
|
|
120
|
+
contentHash: this._contentHash,
|
|
121
|
+
stringTable: this.stringTable.transferables(),
|
|
122
|
+
nodes: this.nodes.transferables(),
|
|
123
|
+
ways: this.ways.transferables(),
|
|
124
|
+
relations: this.relations.transferables(),
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Get the content hash of this OSM dataset.
|
|
129
|
+
* The hash is computed when indexes are built.
|
|
130
|
+
*
|
|
131
|
+
* @returns A hex string hash uniquely identifying the content.
|
|
132
|
+
*/
|
|
133
|
+
contentHash() {
|
|
134
|
+
return this._contentHash;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Check if this OSM dataset has identical content to another.
|
|
138
|
+
* Uses the pre-computed content hash for fast comparison.
|
|
139
|
+
*
|
|
140
|
+
* @param other - The other Osm instance to compare with.
|
|
141
|
+
* @returns True if both datasets have identical content.
|
|
142
|
+
*/
|
|
143
|
+
isEqual(other) {
|
|
144
|
+
if (!other)
|
|
145
|
+
return false;
|
|
146
|
+
return this._contentHash === other._contentHash;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Compute a content hash of all underlying data.
|
|
150
|
+
* This hash uniquely identifies the dataset content regardless of metadata.
|
|
151
|
+
*
|
|
152
|
+
* @returns A hex string hash of the content.
|
|
153
|
+
*/
|
|
154
|
+
computeContentHash() {
|
|
155
|
+
const hasher = new ContentHasher();
|
|
156
|
+
// Hash string table first (shared by all entities)
|
|
157
|
+
this.stringTable.updateHash(hasher);
|
|
158
|
+
// Hash each entity collection
|
|
159
|
+
this.nodes.updateHash(hasher);
|
|
160
|
+
this.ways.updateHash(hasher);
|
|
161
|
+
this.relations.updateHash(hasher);
|
|
162
|
+
return hasher.digest();
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
//# sourceMappingURL=osm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"osm.js","sourceRoot":"","sources":["../../src/osm.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAA2B,MAAM,SAAS,CAAA;AACxD,OAAO,EAAE,SAAS,EAA+B,MAAM,aAAa,CAAA;AACpE,OAAO,WAAW,EAAE,EAAiC,MAAM,eAAe,CAAA;AAE1E,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AACvC,OAAO,EAAE,IAAI,EAA0B,MAAM,QAAQ,CAAA;AA4BrD;;GAEG;AACH,MAAM,OAAO,GAAG;IACf,2CAA2C;IAClC,EAAE,CAAQ;IACV,MAAM,CAAmB;IAElC,gEAAgE;IACvD,WAAW,CAAa;IACxB,KAAK,CAAO;IACZ,IAAI,CAAM;IACV,SAAS,CAAW;IAErB,UAAU,GAAG,KAAK,CAAA;IAClB,YAAY,GAAG,EAAE,CAAA;IAEzB;;OAEG;IACH,YAAY,IAAmD;QAC9D,IAAI,CAAC,EAAE,GAAG,IAAI,EAAE,EAAE,IAAI,SAAS,CAAA;QAC/B,IAAI,CAAC,MAAM,GAAG,IAAI,EAAE,MAAM,IAAI;YAC7B,iBAAiB,EAAE,EAAE;YACrB,iBAAiB,EAAE,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