Skip to content

Commit 2d12fef

Browse files
authored
Patch for maplibre-native failing with maplibre-contour pbf vector tiles (#13)
* try to patch encoding * fix patch * Fix patch for maplibre-native (works)
1 parent 40064eb commit 2d12fef

File tree

1 file changed

+47
-1
lines changed

1 file changed

+47
-1
lines changed

patches/maplibre-contour+0.1.0.patch

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,50 @@ index 1234567..abcdefg 100644
99
+ "default": "./dist/index.mjs",
1010
"module": "./dist/index.mjs",
1111
"require": "./dist/index.cjs",
12-
"types": "./dist/index.d.ts",
12+
"types": "./dist/index.d.ts",
13+
diff --git a/node_modules/maplibre-contour/dist/index.mjs b/node_modules/maplibre-contour/dist/index.mjs
14+
index 2345678..bcdefgh 100644
15+
--- a/node_modules/maplibre-contour/dist/index.mjs
16+
+++ b/node_modules/maplibre-contour/dist/index.mjs
17+
@@ -2077,7 +2077,7 @@ class LocalDemManager {
18+
},
19+
});
20+
mark === null || mark === void 0 ? void 0 : mark();
21+
- return { arrayBuffer: result.buffer };
22+
+ return { arrayBuffer: result.slice().buffer };
23+
}), parentAbortController);
24+
}
25+
}
26+
diff --git a/node_modules/maplibre-contour/dist/index.mjs b/node_modules/maplibre-contour/dist/index.mjs
27+
index 2345678..bcdefgh 100644
28+
--- a/node_modules/maplibre-contour/dist/index.mjs
29+
+++ b/node_modules/maplibre-contour/dist/index.mjs
30+
@@ -1724,9 +1724,8 @@ function encodeVectorTile(tile) {
31+
function writeLayer(layer, pbf) {
32+
if (!pbf)
33+
throw new Error("pbf undefined");
34+
- pbf.writeVarintField(15, 2);
35+
- pbf.writeStringField(1, layer.id || "");
36+
- pbf.writeVarintField(5, layer.extent || 4096);
37+
+ pbf.writeStringField(1, layer.id || ""); // name (required, field 1)
38+
+ // Write all features (field 2)
39+
const context = {
40+
keys: [],
41+
values: [],
42+
@@ -1737,12 +1736,16 @@ function writeLayer(layer, pbf) {
43+
context.feature = feature;
44+
pbf.writeMessage(2, writeFeature, context);
45+
}
46+
+ // Write all keys (field 3)
47+
for (const key of context.keys) {
48+
pbf.writeStringField(3, key);
49+
}
50+
+ // Write all values (field 4)
51+
for (const value of context.values) {
52+
pbf.writeMessage(4, writeValue, value);
53+
}
54+
+ pbf.writeVarintField(5, layer.extent || 4096); // extent (field 5)
55+
+ pbf.writeVarintField(15, 2); // version (field 15, LAST)
56+
}
57+
function writeFeature(context, pbf) {
58+
const feature = context.feature;

0 commit comments

Comments
 (0)