From 7ec0fec5756ed828971016c853e9619b0d156cae Mon Sep 17 00:00:00 2001 From: pietervdvn Date: Wed, 6 Oct 2021 13:20:42 +0200 Subject: [PATCH 1/2] Disable splitting of roads on production --- assets/themes/cyclestreets/cyclestreets.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/themes/cyclestreets/cyclestreets.json b/assets/themes/cyclestreets/cyclestreets.json index 39f75ac78..1f688cac6 100644 --- a/assets/themes/cyclestreets/cyclestreets.json +++ b/assets/themes/cyclestreets/cyclestreets.json @@ -284,6 +284,6 @@ } ], "overrideAll": { - "allowSplit": true + "allowSplit": false } } \ No newline at end of file From 5e36ae48c1a060739bc76e3470f7b4fbc7d28106 Mon Sep 17 00:00:00 2001 From: pietervdvn Date: Thu, 7 Oct 2021 18:58:45 +0200 Subject: [PATCH 2/2] The OsmFeature source now filters features based on the layers in the layout. Fixes #500 --- .../TiledFeatureSource/OsmFeatureSource.ts | 17 +++++++++++++++++ Models/Constants.ts | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/Logic/FeatureSource/TiledFeatureSource/OsmFeatureSource.ts b/Logic/FeatureSource/TiledFeatureSource/OsmFeatureSource.ts index 5641d5b98..28f3923ec 100644 --- a/Logic/FeatureSource/TiledFeatureSource/OsmFeatureSource.ts +++ b/Logic/FeatureSource/TiledFeatureSource/OsmFeatureSource.ts @@ -8,6 +8,9 @@ import {FeatureSourceForLayer, Tiled} from "../FeatureSource"; import {Tiles} from "../../../Models/TileRange"; import {BBox} from "../../BBox"; import {OsmConnection} from "../../Osm/OsmConnection"; +import LayoutConfig from "../../../Models/ThemeConfig/LayoutConfig"; +import {Or} from "../../Tags/Or"; +import {TagsFilter} from "../../Tags/TagsFilter"; export default class OsmFeatureSource { private readonly _backend: string; @@ -26,6 +29,7 @@ export default class OsmFeatureSource { markTileVisited?: (tileId: number) => void }; private readonly downloadedTiles = new Set() + private readonly allowedTags: TagsFilter; constructor(options: { handleTile: (tile: FeatureSourceForLayer & Tiled) => void; @@ -34,6 +38,7 @@ export default class OsmFeatureSource { state: { readonly filteredLayers: UIEventSource; readonly osmConnection: OsmConnection; + readonly layoutToUse: LayoutConfig }, markTileVisited?: (tileId: number) => void }) { @@ -64,6 +69,12 @@ export default class OsmFeatureSource { } self.isRunning.setData(false) }) + + + const neededLayers = options.state.layoutToUse.layers + .filter( layer => !layer.doNotDownload ) + .filter(layer => layer.source.geojsonSource === undefined || layer.source.isOsmCacheLayer) + this.allowedTags = new Or(neededLayers.map(l => l.source.osmTags)) } private async LoadTile(z, x, y): Promise { @@ -85,6 +96,12 @@ export default class OsmFeatureSource { { flatProperties: true }); + + // The geojson contains _all_ features at the given location + // We only keep what is needed + + geojson.features = geojson.features.filter(feature => this.allowedTags.matchesProperties(feature.properties)) + console.log("Tile geojson:", z, x, y, "is", geojson) const index = Tiles.tile_index(z, x, y); new PerLayerFeatureSourceSplitter(this.filteredLayers, diff --git a/Models/Constants.ts b/Models/Constants.ts index b4d8eb6a3..4015d66d8 100644 --- a/Models/Constants.ts +++ b/Models/Constants.ts @@ -2,7 +2,7 @@ import {Utils} from "../Utils"; export default class Constants { - public static vNumber = "0.10.1"; + public static vNumber = "0.10.2"; public static ImgurApiKey = '7070e7167f0a25a' public static readonly mapillary_client_token_v3 = 'TXhLaWthQ1d4RUg0czVxaTVoRjFJZzowNDczNjUzNmIyNTQyYzI2' public static readonly mapillary_client_token_v4 = "MLY|4441509239301885|b40ad2d3ea105435bd40c7e76993ae85"