@osmix/shared 0.0.8 → 0.0.10

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.
Files changed (125) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/content-hasher.d.ts +28 -0
  3. package/dist/content-hasher.d.ts.map +1 -0
  4. package/dist/content-hasher.js +62 -0
  5. package/dist/content-hasher.js.map +1 -0
  6. package/dist/csv-parse-stream.d.ts +38 -0
  7. package/dist/csv-parse-stream.d.ts.map +1 -0
  8. package/dist/csv-parse-stream.js +157 -0
  9. package/dist/csv-parse-stream.js.map +1 -0
  10. package/dist/relation-kind.d.ts.map +1 -1
  11. package/dist/relation-kind.js +5 -3
  12. package/dist/relation-kind.js.map +1 -1
  13. package/dist/stream-to-bytes.js +2 -1
  14. package/dist/stream-to-bytes.js.map +1 -1
  15. package/dist/utils.d.ts +6 -1
  16. package/dist/utils.d.ts.map +1 -1
  17. package/dist/utils.js +21 -0
  18. package/dist/utils.js.map +1 -1
  19. package/package.json +1 -1
  20. package/src/content-hasher.ts +70 -0
  21. package/src/csv-parse-stream.ts +215 -0
  22. package/src/relation-kind.ts +5 -3
  23. package/src/stream-to-bytes.ts +1 -1
  24. package/src/utils.ts +20 -0
  25. package/test/csv-parse-stream.test.ts +74 -0
  26. package/dist/src/assert.d.ts +0 -24
  27. package/dist/src/assert.d.ts.map +0 -1
  28. package/dist/src/assert.js +0 -28
  29. package/dist/src/assert.js.map +0 -1
  30. package/dist/src/bbox-intersects.d.ts +0 -15
  31. package/dist/src/bbox-intersects.d.ts.map +0 -1
  32. package/dist/src/bbox-intersects.js +0 -24
  33. package/dist/src/bbox-intersects.js.map +0 -1
  34. package/dist/src/bytes-to-stream.d.ts +0 -18
  35. package/dist/src/bytes-to-stream.d.ts.map +0 -1
  36. package/dist/src/bytes-to-stream.js +0 -25
  37. package/dist/src/bytes-to-stream.js.map +0 -1
  38. package/dist/src/color.d.ts +0 -4
  39. package/dist/src/color.d.ts.map +0 -1
  40. package/dist/src/color.js +0 -33
  41. package/dist/src/color.js.map +0 -1
  42. package/dist/src/concat-bytes.d.ts +0 -5
  43. package/dist/src/concat-bytes.d.ts.map +0 -1
  44. package/dist/src/concat-bytes.js +0 -14
  45. package/dist/src/concat-bytes.js.map +0 -1
  46. package/dist/src/coordinates.d.ts +0 -28
  47. package/dist/src/coordinates.d.ts.map +0 -1
  48. package/dist/src/coordinates.js +0 -38
  49. package/dist/src/coordinates.js.map +0 -1
  50. package/dist/src/haversine-distance.d.ts +0 -16
  51. package/dist/src/haversine-distance.d.ts.map +0 -1
  52. package/dist/src/haversine-distance.js +0 -26
  53. package/dist/src/haversine-distance.js.map +0 -1
  54. package/dist/src/lineclip.d.ts +0 -2
  55. package/dist/src/lineclip.d.ts.map +0 -1
  56. package/dist/src/lineclip.js +0 -3
  57. package/dist/src/lineclip.js.map +0 -1
  58. package/dist/src/progress.d.ts +0 -42
  59. package/dist/src/progress.d.ts.map +0 -1
  60. package/dist/src/progress.js +0 -53
  61. package/dist/src/progress.js.map +0 -1
  62. package/dist/src/relation-kind.d.ts +0 -69
  63. package/dist/src/relation-kind.d.ts.map +0 -1
  64. package/dist/src/relation-kind.js +0 -375
  65. package/dist/src/relation-kind.js.map +0 -1
  66. package/dist/src/relation-multipolygon.d.ts +0 -43
  67. package/dist/src/relation-multipolygon.d.ts.map +0 -1
  68. package/dist/src/relation-multipolygon.js +0 -195
  69. package/dist/src/relation-multipolygon.js.map +0 -1
  70. package/dist/src/stream-to-bytes.d.ts +0 -18
  71. package/dist/src/stream-to-bytes.d.ts.map +0 -1
  72. package/dist/src/stream-to-bytes.js +0 -30
  73. package/dist/src/stream-to-bytes.js.map +0 -1
  74. package/dist/src/test/fixtures.d.ts +0 -36
  75. package/dist/src/test/fixtures.d.ts.map +0 -1
  76. package/dist/src/test/fixtures.js +0 -175
  77. package/dist/src/test/fixtures.js.map +0 -1
  78. package/dist/src/throttle.d.ts +0 -25
  79. package/dist/src/throttle.d.ts.map +0 -1
  80. package/dist/src/throttle.js +0 -34
  81. package/dist/src/throttle.js.map +0 -1
  82. package/dist/src/tile.d.ts +0 -34
  83. package/dist/src/tile.d.ts.map +0 -1
  84. package/dist/src/tile.js +0 -72
  85. package/dist/src/tile.js.map +0 -1
  86. package/dist/src/transform-bytes.d.ts +0 -24
  87. package/dist/src/transform-bytes.d.ts.map +0 -1
  88. package/dist/src/transform-bytes.js +0 -28
  89. package/dist/src/transform-bytes.js.map +0 -1
  90. package/dist/src/types.d.ts +0 -99
  91. package/dist/src/types.d.ts.map +0 -1
  92. package/dist/src/types.js +0 -9
  93. package/dist/src/types.js.map +0 -1
  94. package/dist/src/utils.d.ts +0 -30
  95. package/dist/src/utils.d.ts.map +0 -1
  96. package/dist/src/utils.js +0 -70
  97. package/dist/src/utils.js.map +0 -1
  98. package/dist/src/way-is-area.d.ts +0 -24
  99. package/dist/src/way-is-area.d.ts.map +0 -1
  100. package/dist/src/way-is-area.js +0 -104
  101. package/dist/src/way-is-area.js.map +0 -1
  102. package/dist/src/zigzag.d.ts +0 -33
  103. package/dist/src/zigzag.d.ts.map +0 -1
  104. package/dist/src/zigzag.js +0 -40
  105. package/dist/src/zigzag.js.map +0 -1
  106. package/dist/test/haversine-distance.test.d.ts +0 -2
  107. package/dist/test/haversine-distance.test.d.ts.map +0 -1
  108. package/dist/test/haversine-distance.test.js +0 -8
  109. package/dist/test/haversine-distance.test.js.map +0 -1
  110. package/dist/test/relation-kind.test.d.ts +0 -2
  111. package/dist/test/relation-kind.test.d.ts.map +0 -1
  112. package/dist/test/relation-kind.test.js +0 -367
  113. package/dist/test/relation-kind.test.js.map +0 -1
  114. package/dist/test/relation-multipolygon.test.d.ts +0 -2
  115. package/dist/test/relation-multipolygon.test.d.ts.map +0 -1
  116. package/dist/test/relation-multipolygon.test.js +0 -237
  117. package/dist/test/relation-multipolygon.test.js.map +0 -1
  118. package/dist/test/utils.test.d.ts +0 -2
  119. package/dist/test/utils.test.d.ts.map +0 -1
  120. package/dist/test/utils.test.js +0 -76
  121. package/dist/test/utils.test.js.map +0 -1
  122. package/dist/test/way-is-area.test.d.ts +0 -2
  123. package/dist/test/way-is-area.test.d.ts.map +0 -1
  124. package/dist/test/way-is-area.test.js +0 -31
  125. package/dist/test/way-is-area.test.js.map +0 -1
@@ -1,43 +0,0 @@
1
- /**
2
- * Multipolygon relation building utilities.
3
- *
4
- * Implements the OSM multipolygon relation specification to construct
5
- * polygon geometries from way members. Handles outer/inner roles,
6
- * way connection, and ring closure.
7
- *
8
- * @see https://wiki.openstreetmap.org/wiki/Relation:multipolygon
9
- *
10
- * @module
11
- */
12
- import type { LonLat, OsmRelation, OsmRelationMember, OsmWay } from "./types";
13
- /**
14
- * Get way members from a relation, grouped by role (outer/inner).
15
- */
16
- export declare function getWayMembersByRole(relation: OsmRelation): {
17
- outer: OsmRelationMember[];
18
- inner: OsmRelationMember[];
19
- };
20
- /**
21
- * Connect ways that share endpoints to form a continuous ring.
22
- * Returns an array of rings (each ring is an array of way IDs in order).
23
- *
24
- * This function handles:
25
- * - Ways that are reversed (end matches end, or start matches start).
26
- * - Closed ways (single ways that form a ring).
27
- * - Disconnected chains (multiple independent rings).
28
- */
29
- export declare function connectWaysToRings(wayMembers: OsmWay[]): OsmWay[][];
30
- /**
31
- * Build polygon rings from way members of a relation.
32
- * Returns an array where each element is an array of coordinate rings (outer + inner).
33
- *
34
- * Based on OSM multipolygon relation specification:
35
- * https://wiki.openstreetmap.org/wiki/Relation:multipolygon
36
- *
37
- * This implementation connects way members into closed rings, and then groups them
38
- * into polygons. Currently, it associates all inner rings with every outer ring
39
- * found in the relation, which is a simplification. A robust implementation would
40
- * use point-in-polygon checks to strictly nest holes inside their parent outer ring.
41
- */
42
- export declare function buildRelationRings(relation: OsmRelation, getWay: (wayId: number) => OsmWay | null, getNodeCoordinates: (nodeId: number) => LonLat | undefined): LonLat[][][];
43
- //# sourceMappingURL=relation-multipolygon.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"relation-multipolygon.d.ts","sourceRoot":"","sources":["../../src/relation-multipolygon.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAE7E;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,WAAW,GAAG;IAC3D,KAAK,EAAE,iBAAiB,EAAE,CAAA;IAC1B,KAAK,EAAE,iBAAiB,EAAE,CAAA;CAC1B,CAeA;AAED;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,EAAE,CAwGnE;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,kBAAkB,CACjC,QAAQ,EAAE,WAAW,EACrB,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,GAAG,IAAI,EACxC,kBAAkB,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,GACxD,MAAM,EAAE,EAAE,EAAE,CAwDd"}
@@ -1,195 +0,0 @@
1
- /**
2
- * Multipolygon relation building utilities.
3
- *
4
- * Implements the OSM multipolygon relation specification to construct
5
- * polygon geometries from way members. Handles outer/inner roles,
6
- * way connection, and ring closure.
7
- *
8
- * @see https://wiki.openstreetmap.org/wiki/Relation:multipolygon
9
- *
10
- * @module
11
- */
12
- /**
13
- * Get way members from a relation, grouped by role (outer/inner).
14
- */
15
- export function getWayMembersByRole(relation) {
16
- const outer = [];
17
- const inner = [];
18
- for (const member of relation.members) {
19
- if (member.type !== "way")
20
- continue;
21
- const role = member.role?.toLowerCase() ?? "";
22
- if (role === "outer") {
23
- outer.push(member);
24
- }
25
- else if (role === "inner") {
26
- inner.push(member);
27
- }
28
- }
29
- return { outer, inner };
30
- }
31
- /**
32
- * Connect ways that share endpoints to form a continuous ring.
33
- * Returns an array of rings (each ring is an array of way IDs in order).
34
- *
35
- * This function handles:
36
- * - Ways that are reversed (end matches end, or start matches start).
37
- * - Closed ways (single ways that form a ring).
38
- * - Disconnected chains (multiple independent rings).
39
- */
40
- export function connectWaysToRings(wayMembers) {
41
- if (wayMembers.length === 0)
42
- return [];
43
- const rings = [];
44
- const used = new Set();
45
- const wayMap = new Map();
46
- // Build map of way ID to member
47
- for (const member of wayMembers) {
48
- wayMap.set(member.id, member);
49
- }
50
- // Helper to reverse a way's refs
51
- const reverseWay = (way) => ({
52
- ...way,
53
- refs: [...way.refs].reverse(),
54
- });
55
- // Build rings by connecting ways
56
- for (const startWay of wayMembers) {
57
- if (used.has(startWay.id))
58
- continue;
59
- if (startWay.refs.length < 2)
60
- throw Error("Way has less than 2 refs");
61
- const ring = [startWay];
62
- used.add(startWay.id);
63
- let currentStart = startWay.refs[0];
64
- let currentEnd = startWay.refs[startWay.refs.length - 1];
65
- // Try to extend the ring forward
66
- while (true) {
67
- let found = false;
68
- for (const nextWay of wayMembers) {
69
- if (used.has(nextWay.id))
70
- continue;
71
- if (nextWay.refs.length < 2)
72
- throw Error("Way has less than 2 refs");
73
- const nextStart = nextWay.refs[0];
74
- const nextEnd = nextWay.refs[nextWay.refs.length - 1];
75
- // Check if next way connects to current end
76
- if (currentEnd === nextStart) {
77
- ring.push(nextWay);
78
- used.add(nextWay.id);
79
- currentEnd = nextEnd;
80
- found = true;
81
- break;
82
- }
83
- if (currentEnd === nextEnd) {
84
- // Need to reverse next way
85
- ring.push(reverseWay(nextWay));
86
- used.add(nextWay.id);
87
- currentEnd = nextStart;
88
- found = true;
89
- break;
90
- }
91
- }
92
- if (!found)
93
- break;
94
- }
95
- // Try to extend the ring backward
96
- currentStart = startWay.refs[0];
97
- currentEnd = startWay.refs[startWay.refs.length - 1];
98
- while (true) {
99
- let found = false;
100
- for (const nextWay of wayMembers) {
101
- if (used.has(nextWay.id))
102
- continue;
103
- if (nextWay.refs.length < 2)
104
- throw Error("Way has less than 2 refs");
105
- const nextStart = nextWay.refs[0];
106
- const nextEnd = nextWay.refs[nextWay.refs.length - 1];
107
- // Check if next way connects to current start
108
- if (currentStart === nextEnd) {
109
- ring.unshift(nextWay);
110
- used.add(nextWay.id);
111
- currentStart = nextStart;
112
- found = true;
113
- break;
114
- }
115
- if (currentStart === nextStart) {
116
- // Need to reverse next way
117
- ring.unshift(reverseWay(nextWay));
118
- used.add(nextWay.id);
119
- currentStart = nextEnd;
120
- found = true;
121
- break;
122
- }
123
- }
124
- if (!found)
125
- break;
126
- }
127
- // Only add ring if it's closed (first and last node are the same)
128
- if (ring.length > 0) {
129
- const firstWay = ring[0];
130
- const lastWay = ring[ring.length - 1];
131
- if (firstWay?.refs[0] === lastWay?.refs[lastWay.refs.length - 1]) {
132
- rings.push(ring);
133
- }
134
- }
135
- }
136
- return rings;
137
- }
138
- /**
139
- * Build polygon rings from way members of a relation.
140
- * Returns an array where each element is an array of coordinate rings (outer + inner).
141
- *
142
- * Based on OSM multipolygon relation specification:
143
- * https://wiki.openstreetmap.org/wiki/Relation:multipolygon
144
- *
145
- * This implementation connects way members into closed rings, and then groups them
146
- * into polygons. Currently, it associates all inner rings with every outer ring
147
- * found in the relation, which is a simplification. A robust implementation would
148
- * use point-in-polygon checks to strictly nest holes inside their parent outer ring.
149
- */
150
- export function buildRelationRings(relation, getWay, getNodeCoordinates) {
151
- const { outer, inner } = getWayMembersByRole(relation);
152
- // Connect outer ways into rings
153
- const outerRings = connectWaysToRings(outer.map((m) => getWay(m.ref)).filter((w) => w !== null));
154
- // Connect inner ways into rings
155
- const innerRings = connectWaysToRings(inner.map((m) => getWay(m.ref)).filter((w) => w !== null));
156
- const wayRingToCoords = (ring) => {
157
- const coords = [];
158
- for (const way of ring) {
159
- for (const nodeId of way.refs) {
160
- const coord = getNodeCoordinates(nodeId);
161
- if (coord)
162
- coords.push(coord);
163
- }
164
- }
165
- // Ensure ring is closed
166
- if (coords.length > 0) {
167
- const first = coords[0];
168
- const last = coords[coords.length - 1];
169
- if (first && last && (first[0] !== last[0] || first[1] !== last[1])) {
170
- coords.push([first[0], first[1]]);
171
- }
172
- }
173
- return coords;
174
- };
175
- // Convert way rings to coordinate rings
176
- const coordinateRings = [];
177
- for (const outerRing of outerRings) {
178
- const outerCoordinates = wayRingToCoords(outerRing);
179
- if (outerCoordinates.length >= 3) {
180
- // Find inner rings that belong to this outer ring
181
- const innerCoordinates = [];
182
- for (const innerRing of innerRings) {
183
- const innerCoords = wayRingToCoords(innerRing);
184
- if (innerCoords.length >= 3) {
185
- // TODO: do proper point-in-polygon test with https://github.com/rowanwins/point-in-polygon-hao
186
- innerCoordinates.push(innerCoords);
187
- }
188
- }
189
- // Create polygon: [outer ring, ...inner rings]
190
- coordinateRings.push([outerCoordinates, ...innerCoordinates]);
191
- }
192
- }
193
- return coordinateRings;
194
- }
195
- //# sourceMappingURL=relation-multipolygon.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"relation-multipolygon.js","sourceRoot":"","sources":["../../src/relation-multipolygon.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAIH;;GAEG;AACH,MAAM,UAAU,mBAAmB,CAAC,QAAqB;IAIxD,MAAM,KAAK,GAAwB,EAAE,CAAA;IACrC,MAAM,KAAK,GAAwB,EAAE,CAAA;IAErC,KAAK,MAAM,MAAM,IAAI,QAAQ,CAAC,OAAO,EAAE,CAAC;QACvC,IAAI,MAAM,CAAC,IAAI,KAAK,KAAK;YAAE,SAAQ;QACnC,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,CAAA;QAC7C,IAAI,IAAI,KAAK,OAAO,EAAE,CAAC;YACtB,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;QACnB,CAAC;aAAM,IAAI,IAAI,KAAK,OAAO,EAAE,CAAC;YAC7B,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;QACnB,CAAC;IACF,CAAC;IAED,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,CAAA;AAC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ream and concatenates all chunks into a single Uint8Array.
5
- *
6
- * @module
7
- */
8
- /**
9
- * Consume a ReadableStream and return all data as a single Uint8Array.
10
- *
11
- * Reads all chunks from the stream and concatenates them.
12
- * The stream will be fully consumed after this function returns.
13
- *
14
- * @param stream - The stream to consume.
15
- * @returns A Promise resolving to the concatenated bytes.
16
- */
17
- export declare function streamToBytes(stream: ReadableStream<Uint8Array<ArrayBuffer>>): Promise<Uint8Array<ArrayBuffer>>;
18
- //# sourceMappingURL=stream-to-bytes.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"stream-to-bytes.d.ts","sourceRoot":"","sources":["../../src/stream-to-bytes.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH;;;;;;;;GAQG;AACH,wBAAsB,aAAa,CAClC,MAAM,EAAE,cAAc,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,GAC7C,OAAO,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,CAelC"}
@@ -1,30 +0,0 @@
1
- /**
2
- * Stream to byte array conversion.
3
- *
4
- * Consumes a ReadableStream and concatenates all chunks into a single Uint8Array.
5
- *
6
- * @module
7
- */
8
- import { concatBytes } from "./concat-bytes";
9
- /**
10
- * Consume a ReadableStream and return all data as a single Uint8Array.
11
- *
12
- * Reads all chunks from the stream and concatenates them.
13
- * The stream will be fully consumed after this function returns.
14
- *
15
- * @param stream - The stream to consume.
16
- * @returns A Promise resolving to the concatenated bytes.
17
- */
18
- export async function streamToBytes(stream) {
19
- const reader = stream.getReader();
20
- const chunks = [];
21
- while (true) {
22
- const { done, value } = await reader.read();
23
- if (done) {
24
- break;
25
- }
26
- chunks.push(value);
27
- }
28
- return concatBytes(chunks);
29
- }
30
- //# sourceMappingURL=stream-to-bytes.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"stream-to-bytes.js","sourceRoot":"","sources":["../../src/stream-to-bytes.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAE5C;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CAClC,MAA+C;IAE/C,MAAM,MAAM,GAAG,MAAM,CAAC,SAAS,EAAE,CAAA;IACjC,MAAM,MAAM,GAA8B,EAAE,CAAA;IAE5C,OAAO,IAAI,EAAE,CAAC;QACb,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,MAAM,MAAM,CAAC,IAAI,EAAE,CAAA;QAE3C,IAAI,IAAI,EAAE,CAAC;YACV,MAAK;QACN,CAAC;QAED,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;IACnB,CAAC;IAED,OAAO,WAAW,CAAC,MAAM,CAAC,CAAA;AAC3B,CAAC"}
@@ -1,36 +0,0 @@
1
- export declare function getFixturePath(url: string): string;
2
- /**
3
- * Get file from the cache folder or download it from the URL
4
- */
5
- export declare function getFixtureFile(url: string): Promise<Uint8Array<ArrayBufferLike>>;
6
- export declare function getFixtureFileReadStream(url: string): ReadableStream<Uint8Array<ArrayBuffer>>;
7
- export declare function getFixtureFileWriteStream(url: string): WritableStream<Uint8Array<ArrayBufferLike>>;
8
- export type PbfFixture = {
9
- url: string;
10
- bbox: {
11
- bottom: number;
12
- top: number;
13
- left: number;
14
- right: number;
15
- };
16
- nodesWithTags: number;
17
- nodes: number;
18
- ways: number;
19
- relations: number;
20
- node0: {
21
- lat: number;
22
- lon: number;
23
- id: number;
24
- };
25
- way0: number;
26
- relation0: number;
27
- uniqueStrings: number;
28
- primitiveGroups: number;
29
- };
30
- export declare const AllPBFs: Record<string, PbfFixture>;
31
- /**
32
- * A subset of the PBFs that we want to use for current tests. Do not check in changes to this list as it will cause CI to
33
- * attempt to download PBFs that are not checked into the repository.
34
- */
35
- export declare const PBFs: Record<string, PbfFixture>;
36
- //# sourceMappingURL=fixtures.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"fixtures.d.ts","sourceRoot":"","sources":["../../../src/test/fixtures.ts"],"names":[],"mappings":"AAOA,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,UAOzC;AAED;;GAEG;AACH,wBAAsB,cAAc,CACnC,GAAG,EAAE,MAAM,GACT,OAAO,CAAC,UAAU,CAAC,eAAe,CAAC,CAAC,CAetC;AAED,wBAAgB,wBAAwB,CAAC,GAAG,EAAE,MAAM,2CAEnD;AAED,wBAAgB,yBAAyB,CAAC,GAAG,EAAE,MAAM,+CAUpD;AAED,MAAM,MAAM,UAAU,GAAG;IACxB,GAAG,EAAE,MAAM,CAAA;IACX,IAAI,EAAE;QACL,MAAM,EAAE,MAAM,CAAA;QACd,GAAG,EAAE,MAAM,CAAA;QACX,IAAI,EAAE,MAAM,CAAA;QACZ,KAAK,EAAE,MAAM,CAAA;KACb,CAAA;IACD,aAAa,EAAE,MAAM,CAAA;IACrB,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,EAAE,MAAM,CAAA;IACjB,KAAK,EAAE;QACN,GAAG,EAAE,MAAM,CAAA;QACX,GAAG,EAAE,MAAM,CAAA;QACX,EAAE,EAAE,MAAM,CAAA;KACV,CAAA;IACD,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,EAAE,MAAM,CAAA;IACjB,aAAa,EAAE,MAAM,CAAA;IACrB,eAAe,EAAE,MAAM,CAAA;CACvB,CAAA;AAiCD,eAAO,MAAM,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CA0FrC,CAAA;AAEV;;;GAGG;AACH,eAAO,MAAM,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAgC,CAAA"}
@@ -1,175 +0,0 @@
1
- import { dirname, join, resolve } from "node:path";
2
- import { fileURLToPath } from "node:url";
3
- const __dirname = dirname(fileURLToPath(import.meta.url));
4
- const ROOT_DIR = resolve(__dirname, "../../../../");
5
- const FIXTURES_DIR = resolve(ROOT_DIR, "fixtures");
6
- export function getFixturePath(url) {
7
- if (url.startsWith("http")) {
8
- const fileName = url.split("/").pop();
9
- if (!fileName)
10
- throw new Error("Invalid URL");
11
- return join(FIXTURES_DIR, fileName);
12
- }
13
- return join(FIXTURES_DIR, url);
14
- }
15
- /**
16
- * Get file from the cache folder or download it from the URL
17
- */
18
- export async function getFixtureFile(url) {
19
- const filePath = getFixturePath(url);
20
- try {
21
- const file = await Bun.file(filePath).arrayBuffer();
22
- return new Uint8Array(file);
23
- }
24
- catch (_error) {
25
- if (process.env["CI"]) {
26
- throw Error(`Do not download fixtures in CI: ${url} not found`);
27
- }
28
- const response = await fetch(url);
29
- const buffer = await response.arrayBuffer();
30
- const data = new Uint8Array(buffer);
31
- await Bun.write(filePath, data);
32
- return data;
33
- }
34
- }
35
- export function getFixtureFileReadStream(url) {
36
- return Bun.file(getFixturePath(url)).stream();
37
- }
38
- export function getFixtureFileWriteStream(url) {
39
- const incrementalWriter = Bun.file(getFixturePath(url)).writer();
40
- return new WritableStream({
41
- write: (chunk) => {
42
- incrementalWriter.write(chunk);
43
- },
44
- close: () => {
45
- incrementalWriter.end();
46
- },
47
- });
48
- }
49
- /**
50
- * List of PBFs and their metadata used for testing. Cached locally in the top level fixtures directory so they can
51
- * be used across packages and apps.
52
- *
53
- * `monaco.pbf` is checked into the repository so it can be used in CI without causing repeated downloads.
54
- *
55
- * Below, we export a subset of the PBFs that we want to use for current tests.
56
- */
57
- const monacoPbfFixture = {
58
- url: "monaco.pbf",
59
- bbox: {
60
- bottom: 43.7232244,
61
- top: 43.7543687,
62
- left: 7.4053929,
63
- right: 7.4447259,
64
- },
65
- nodesWithTags: 1_254,
66
- nodes: 14_286,
67
- ways: 3_346,
68
- relations: 46,
69
- node0: {
70
- lat: 43.7371175,
71
- lon: 7.4229093,
72
- id: 21911883,
73
- },
74
- way0: 4097656,
75
- relation0: 3410831,
76
- uniqueStrings: 1_060,
77
- primitiveGroups: 7,
78
- };
79
- export const AllPBFs = {
80
- monaco: monacoPbfFixture,
81
- montenegro: {
82
- url: "https://download.geofabrik.de/europe/montenegro-250101.osm.pbf",
83
- bbox: {
84
- bottom: 41.61621,
85
- top: 43.562169,
86
- left: 18.17282,
87
- right: 20.358827,
88
- },
89
- nodesWithTags: 63_321,
90
- nodes: 3_915_383,
91
- ways: 321_330,
92
- relations: 5_501,
93
- node0: {
94
- lat: 42.1982436,
95
- lon: 18.9656482,
96
- id: 26860768,
97
- },
98
- way0: 123,
99
- relation0: 123,
100
- uniqueStrings: 55_071,
101
- primitiveGroups: 532,
102
- },
103
- croatia: {
104
- url: "https://download.geofabrik.de/europe/croatia-250101.osm.pbf",
105
- bbox: {
106
- bottom: 42.16483,
107
- top: 46.557562,
108
- left: 13.08916,
109
- right: 19.459968,
110
- },
111
- nodesWithTags: 481_613,
112
- nodes: 23_063_621,
113
- ways: 2_315_247,
114
- relations: 39_098,
115
- primitiveGroups: 3_178,
116
- node0: {
117
- lat: 42.9738772,
118
- lon: 17.021989,
119
- id: 4_511_653,
120
- },
121
- way0: 123,
122
- relation0: 123,
123
- uniqueStrings: 269_315,
124
- },
125
- italy: {
126
- url: "https://download.geofabrik.de/europe/italy-250101.osm.pbf",
127
- bbox: {
128
- bottom: 35.07638,
129
- left: 6.602696,
130
- right: 19.12499,
131
- top: 47.100045,
132
- },
133
- nodesWithTags: 1_513_303,
134
- nodes: 250_818_620,
135
- ways: 27_837_987,
136
- relations: 100_000,
137
- primitiveGroups: 34_901,
138
- node0: {
139
- lat: 41.9033,
140
- lon: 12.4534,
141
- id: 1,
142
- },
143
- way0: 123,
144
- relation0: 123,
145
- uniqueStrings: 3190,
146
- },
147
- washington: {
148
- url: "https://download.geofabrik.de/north-america/us/washington-250101.osm.pbf",
149
- bbox: {
150
- bottom: 45.53882,
151
- top: 49.00708,
152
- left: -126.7423,
153
- right: -116.911526,
154
- },
155
- nodesWithTags: 1_513_303,
156
- nodes: 43_032_447,
157
- ways: 4_541_651,
158
- relations: 44_373,
159
- node0: {
160
- lat: 47.64248,
161
- lon: -122.3196898,
162
- id: 29445653,
163
- },
164
- way0: 123,
165
- relation0: 123,
166
- uniqueStrings: 598_993,
167
- primitiveGroups: 34_901,
168
- },
169
- };
170
- /**
171
- * A subset of the PBFs that we want to use for current tests. Do not check in changes to this list as it will cause CI to
172
- * attempt to download PBFs that are not checked into the repository.
173
- */
174
- export const PBFs = { monaco: monacoPbfFixture };
175
- //# sourceMappingURL=fixtures.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"fixtures.js","sourceRoot":"","sources":["../../../src/test/fixtures.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAExC,MAAM,SAAS,GAAG,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAA;AACzD,MAAM,QAAQ,GAAG,OAAO,CAAC,SAAS,EAAE,cAAc,CAAC,CAAA;AACnD,MAAM,YAAY,GAAG,OAAO,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAA;AAElD,MAAM,UAAU,cAAc,CAAC,GAAW;IACzC,IAAI,GAAG,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC;QAC5B,MAAM,QAAQ,GAAG,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,CAAA;QACrC,IAAI,CAAC,QAAQ;YAAE,MAAM,IAAI,KAAK,CAAC,aAAa,CAAC,CAAA;QAC7C,OAAO,IAAI,CAAC,YAAY,EAAE,QAAQ,CAAC,CAAA;IACpC,CAAC;IACD,OAAO,IAAI,CAAC,YAAY,EAAE,GAAG,CAAC,CAAA;AAC/B,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CACnC,GAAW;IAEX,MAAM,QAAQ,GAAG,cAAc,CAAC,GAAG,CAAC,CAAA;IACpC,IAAI,CAAC;QACJ,MAAM,IAAI,GAAG,MAAM,GAAG,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,IAAI,EAAE,GAAG;QACT,SAAS,EAAE,GAAG;QACd,aAAa,EAAE,OAAO;KACtB;IACD,KAAK,EAAE;QACN,GAAG,EAAE,2DAA2D;QAChE,IAAI,EAAE;YACL,MAAM,EAAE,QAAQ;YAChB,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,QAAQ;YACf,GAAG,EAAE,SAAS;SACd;QACD,aAAa,EAAE,SAAS;QACxB,KAAK,EAAE,WAAW;QAClB,IAAI,EAAE,UAAU;QAChB,SAAS,EAAE,OAAO;QAClB,eAAe,EAAE,MAAM;QACvB,KAAK,EAAE;YACN,GAAG,EAAE,OAAO;YACZ,GAAG,EAAE,OAAO;YACZ,EAAE,EAAE,CAAC;SACL;QACD,IAAI,EAAE,GAAG;QACT,SAAS,EAAE,GAAG;QACd,aAAa,EAAE,IAAI;KACnB;IACD,UAAU,EAAE;QACX,GAAG,EAAE,0EAA0E;QAC/E,IAAI,EAAE;YACL,MAAM,EAAE,QAAQ;YAChB,GAAG,EAAE,QAAQ;YACb,IAAI,EAAE,CAAC,QAAQ;YACf,KAAK,EAAE,CAAC,UAAU;SAClB;QACD,aAAa,EAAE,SAAS;QACxB,KAAK,EAAE,UAAU;QACjB,IAAI,EAAE,SAAS;QACf,SAAS,EAAE,MAAM;QACjB,KAAK,EAAE;YACN,GAAG,EAAE,QAAQ;YACb,GAAG,EAAE,CAAC,WAAW;YACjB,EAAE,EAAE,QAAQ;SACZ;QACD,IAAI,EAAE,GAAG;QACT,SAAS,EAAE,GAAG;QACd,aAAa,EAAE,OAAO;QACtB,eAAe,EAAE,MAAM;KACvB;CACQ,CAAA;AAEV;;;GAGG;AACH,MAAM,CAAC,MAAM,IAAI,GAA+B,EAAE,MAAM,EAAE,gBAAgB,EAAE,CAAA"}
@@ -1,25 +0,0 @@
1
- /**
2
- * Throttling utilities for rate-limiting function calls.
3
- *
4
- * Useful for limiting progress updates from workers or other high-frequency
5
- * operations to avoid overwhelming the UI or logging.
6
- *
7
- * @module
8
- */
9
- /**
10
- * Create a throttled version of a function that only executes at most
11
- * once per `timeFrame` milliseconds.
12
- *
13
- * @param func - The function to throttle.
14
- * @param timeFrame - Minimum time between calls in milliseconds.
15
- * @returns A throttled version of the function.
16
- *
17
- * @example
18
- * ```ts
19
- * const logThrottled = throttle((msg) => console.log(msg), 1000)
20
- * // Only logs at most once per second
21
- * for (let i = 0; i < 1000; i++) logThrottled(`Progress: ${i}`)
22
- * ```
23
- */
24
- export declare function throttle<T extends unknown[]>(func: (...args: T) => void, timeFrame: number): (...args: T) => void;
25
- //# sourceMappingURL=throttle.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"throttle.d.ts","sourceRoot":"","sources":["../../src/throttle.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,QAAQ,CAAC,CAAC,SAAS,OAAO,EAAE,EAC3C,IAAI,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC,KAAK,IAAI,EAC1B,SAAS,EAAE,MAAM,IAGT,GAAG,MAAM,CAAC,UAOlB"}
@@ -1,34 +0,0 @@
1
- /**
2
- * Throttling utilities for rate-limiting function calls.
3
- *
4
- * Useful for limiting progress updates from workers or other high-frequency
5
- * operations to avoid overwhelming the UI or logging.
6
- *
7
- * @module
8
- */
9
- /**
10
- * Create a throttled version of a function that only executes at most
11
- * once per `timeFrame` milliseconds.
12
- *
13
- * @param func - The function to throttle.
14
- * @param timeFrame - Minimum time between calls in milliseconds.
15
- * @returns A throttled version of the function.
16
- *
17
- * @example
18
- * ```ts
19
- * const logThrottled = throttle((msg) => console.log(msg), 1000)
20
- * // Only logs at most once per second
21
- * for (let i = 0; i < 1000; i++) logThrottled(`Progress: ${i}`)
22
- * ```
23
- */
24
- export function throttle(func, timeFrame) {
25
- let lastTime = 0;
26
- return (...args) => {
27
- const now = Date.now();
28
- if (now - lastTime >= timeFrame) {
29
- func(...args);
30
- lastTime = now;
31
- }
32
- };
33
- }
34
- //# sourceMappingURL=throttle.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"throttle.js","sourceRoot":"","sources":["../../src/throttle.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,QAAQ,CACvB,IAA0B,EAC1B,SAAiB;IAEjB,IAAI,QAAQ,GAAG,CAAC,CAAA;IAChB,OAAO,CAAC,GAAG,IAAO,EAAE,EAAE;QACrB,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAA;QACtB,IAAI,GAAG,GAAG,QAAQ,IAAI,SAAS,EAAE,CAAC;YACjC,IAAI,CAAC,GAAG,IAAI,CAAC,CAAA;YACb,QAAQ,GAAG,GAAG,CAAA;QACf,CAAC;IACF,CAAC,CAAA;AACF,CAAC"}
@@ -1,34 +0,0 @@
1
- /**
2
- * XYZ tile coordinate utilities.
3
- *
4
- * Provides conversions between geographic coordinates (lon/lat) and
5
- * tile pixel coordinates for XYZ tiled map systems. Supports various
6
- * tile sizes and zoom levels.
7
- *
8
- * @module
9
- */
10
- import type { GeoBbox2D, LonLat, Tile, TilePxBbox, XY } from "./types";
11
- /**
12
- * Get the geographic bounding box of a tile.
13
- * Returns [west, south, east, north].
14
- */
15
- export declare function tileToBbox(tile: Tile): GeoBbox2D;
16
- /**
17
- * Convert a bounding box from geographic coordinates to tile pixel coordinates.
18
- */
19
- export declare function bboxToTilePx(bbox: GeoBbox2D, tile: Tile, tileSize?: number): TilePxBbox;
20
- /**
21
- * Convert a geographic coordinate to tile pixel coordinates.
22
- * Returns [x, y] in pixels relative to the top-left of the tile.
23
- */
24
- export declare function llToTilePx(ll: LonLat, tile: Tile, tileSize?: number): XY;
25
- /**
26
- * Convert tile pixel coordinates to geographic coordinates.
27
- */
28
- export declare function tilePxToLonLat(px: XY, tile: Tile, tileSize?: number): LonLat;
29
- /**
30
- * Clamp a pixel coordinate to the tile bounds and round to the nearest integer. Useful for converting a floating point pixel
31
- * coordinate to a the exact tile pixel it is contained by.
32
- */
33
- export declare function clampAndRoundPx(px: XY, tileSizeOrBbox: number | GeoBbox2D): XY;
34
- //# sourceMappingURL=tile.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"tile.d.ts","sourceRoot":"","sources":["../../src/tile.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,EAAE,EAAE,MAAM,SAAS,CAAA;AAatE;;;GAGG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,IAAI,GAAG,SAAS,CAOhD;AAED;;GAEG;AACH,wBAAgB,YAAY,CAC3B,IAAI,EAAE,SAAS,EACf,IAAI,EAAE,IAAI,EACV,QAAQ,SAAM,GACZ,UAAU,CAIZ;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,SAAM,GAAG,EAAE,CAMrE;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,SAAM,GAAG,MAAM,CAKzE;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAC9B,EAAE,EAAE,EAAE,EACN,cAAc,EAAE,MAAM,GAAG,SAAS,GAChC,EAAE,CASJ"}