Fixes to wayhandling

This commit is contained in:
Pieter Vander Vennet 2020-10-27 14:46:40 +01:00
parent 032bf89017
commit 813e96f8df
4 changed files with 17 additions and 16 deletions

View file

@ -140,21 +140,24 @@ export class FilteredLayer {
const selfFeatures = [];
for (let feature of geojson.features) {
// feature.properties contains all the properties
const tags = TagUtils.proprtiesToKV(feature.properties);
const centerPoint = GeoOperations.centerpoint(feature);
if (!this.filters.matches(tags)) {
leftoverFeatures.push(feature);
continue;
}
if (feature.geometry.type !== "Point") {
const centerPoint = GeoOperations.centerpoint(feature);
if (this._wayHandling === LayerConfig.WAYHANDLING_CENTER_AND_WAY) {
selfFeatures.push(centerPoint);
} else if (this._wayHandling === LayerConfig.WAYHANDLING_CENTER_ONLY) {
feature = centerPoint;
}
}
if (this.filters.matches(tags)) {
selfFeatures.push(feature);
} else {
leftoverFeatures.push(feature);
}
selfFeatures.push(feature);
}