Skip to content

Commit

Permalink
refactor(MVTParser): 1 feature per vtfeature
Browse files Browse the repository at this point in the history
  • Loading branch information
ftoromanoff committed Jan 15, 2025
1 parent a2cfd3a commit 25db866
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/Parser/VectorTileParser.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,19 @@ function readPBF(file, options) {
const layers = options.in.layers[vtLayerName]
.filter(l => l.filterExpression.filter({ zoom: z }, vtFeature));

let feature;
for (const layer of layers) {
const feature = collection.requestFeatureById(layer.id, vtFeature.type - 1);
feature.id = layer.id;
feature.order = layer.order;
feature.style = options.in.styles[feature.id];
vtFeatureToFeatureGeometry(vtFeature, feature);
}


/*
// This optimization is not fully working and need to be reassessed
// (see https://github.com/iTowns/itowns/pull/2469/files#r1861802136)
let feature;
for (const layer of layers) {
if (!feature) {
feature = collection.requestFeatureById(layer.id, vtFeature.type - 1);
Expand All @@ -168,6 +179,7 @@ function readPBF(file, options) {
feature.style = options.in.styles[feature.id];
}
}
*/
}
});

Expand Down

0 comments on commit 25db866

Please sign in to comment.