Fix traffic sign rendering and geometry conversion

This commit is contained in:
Nikola Pleša
2021-06-15 10:56:08 +02:00
parent 7a0d8adb7b
commit 87a823f093
2 changed files with 7 additions and 5 deletions
+7 -4
View File
@@ -2,7 +2,6 @@
import { dispatch as d3_dispatch } from 'd3-dispatch';
import { select as d3_select } from 'd3-selection';
import base64 from 'base64-js';
import Protobuf from 'pbf';
import RBush from 'rbush';
import { VectorTile } from '@mapbox/vector-tile';
@@ -165,7 +164,7 @@ function loadTileDataToCache(data, tile, which) {
if (vectorTile.layers.hasOwnProperty('traffic_sign')) {
features = [];
cache = _mlyCache[which];
layer = vectorTile.layers.point;
layer = vectorTile.layers.traffic_sign;
for (i = 0; i < layer.length; i++) {
feature = layer.feature(i).toGeoJSON(tile.xyz[0], tile.xyz[1], tile.xyz[2]);
@@ -719,8 +718,12 @@ export default {
_mlyHighlightedDetection = null;
}
const geometry = base64.toByteArray(data.geometry);
const tile = new VectorTile(new Protobuf(geometry));
var decodedGeometry = window.atob(data.geometry);
var uintArray = new Uint8Array(decodedGeometry.length);
for (var i = 0; i < decodedGeometry.length; i++) {
uintArray[i] = decodedGeometry.charCodeAt(i);
}
const tile = new VectorTile(new Protobuf(uintArray.buffer));
const layer = tile.layers['mpy-or'];
const geometries = layer.feature(0).loadGeometry();
-1
View File
@@ -52,7 +52,6 @@
"abortcontroller-polyfill": "^1.4.0",
"aes-js": "^3.1.2",
"alif-toolkit": "^1.2.9",
"base64-js": "1.5.1",
"core-js": "^3.6.5",
"diacritics": "1.3.0",
"fast-deep-equal": "~3.1.1",