Refactoring: improve caching

This commit is contained in:
Pieter Vander Vennet 2023-04-18 23:44:49 +02:00
parent f203a1158d
commit e36e9123f3
5 changed files with 91 additions and 20 deletions

View file

@ -20,7 +20,14 @@ export default class LocalStorageFeatureSource extends DynamicTileSource {
const storage = TileLocalStorage.construct<Feature[]>(layername)
super(
zoomlevel,
(tileIndex) => new StaticFeatureSource(storage.getTileSource(tileIndex)),
(tileIndex) =>
new StaticFeatureSource(
storage
.getTileSource(tileIndex)
.map((features) =>
features?.filter((f) => !f.properties.id.match(/(node|way)\/-[0-9]+/))
)
),
mapProperties,
options
)