Add point-only layer for nature reserves, mark point-only layer as old (so that geometries will show up)

This commit is contained in:
Pieter Vander Vennet 2021-07-23 19:12:13 +02:00
parent b79be77686
commit 135219b5dc
4 changed files with 31 additions and 6 deletions

View file

@ -16,7 +16,7 @@ import RegisteringFeatureSource from "./RegisteringFeatureSource";
export default class FeaturePipeline implements FeatureSource {
public features: UIEventSource<{ feature: any; freshness: Date }[]> ;
public features: UIEventSource<{ feature: any; freshness: Date }[]>;
public readonly name = "FeaturePipeline"
@ -29,7 +29,7 @@ export default class FeaturePipeline implements FeatureSource {
selectedElement: UIEventSource<any>) {
const allLoadedFeatures = new UIEventSource<{ feature: any; freshness: Date }[]>([])
// first we metatag, then we save to get the metatags into storage too
// Note that we need to register before we do metatagging (as it expects the event sources)
@ -46,8 +46,11 @@ export default class FeaturePipeline implements FeatureSource {
const geojsonSources: FeatureSource [] = GeoJsonSource
.ConstructMultiSource(flayers.data, locationControl)
.map(geojsonSource => {
let source = new RegisteringFeatureSource(new FeatureDuplicatorPerLayer(flayers, geojsonSource));
if(!geojsonSource.isOsmCache){
let source = new RegisteringFeatureSource(
new FeatureDuplicatorPerLayer(flayers,
geojsonSource
));
if (!geojsonSource.isOsmCache) {
source = new MetaTaggingFeatureSource(allLoadedFeatures, source, updater.features);
}
return source

View file

@ -175,7 +175,7 @@ export default class GeoJsonSource implements FeatureSource {
let freshness: Date = time;
if (feature.properties["_last_edit:timestamp"] !== undefined) {
freshness = new Date(feature["_last_edit:timestamp"])
freshness = new Date(feature.properties["_last_edit:timestamp"])
}
newFeatures.push({feature: feature, freshness: freshness})

View file

@ -27,6 +27,7 @@
"defaultBackgroundId": "CartoDB.Positron",
"layers": [
{
"#": "Nature reserve with geometry, z>=13",
"builtin": "nature_reserve",
"override": {
"source": {
@ -39,7 +40,25 @@
"geoJsonZoomLevel": 12,
"isOsmCache": true
},
"minzoom": "10",
"minzoom": "13",
"icon": {
"render": "circle:#FE6F32;./assets/themes/natuurpunt/nature_reserve.svg"
}
}
},
{
"#": "Nature reserve overview from cache, points only, z < 13",
"builtin": "nature_reserve",
"override": {
"source": {
"osmTags": {
"+and": [
"operator~.*[nN]atuurpunt.*"
]
},
"geoJson": "https://pietervdvn.github.io/natuurpunt_cache/natuurpunt_nature_reserve_points.geojson"
},
"minzoom": "0",
"icon": {
"render": "circle:#FE6F32;./assets/themes/natuurpunt/nature_reserve.svg"
}

View file

@ -274,6 +274,9 @@ async function createOverview(targetdir: string, r: TileRange, z: number, layern
}
const features = JSON.parse(fs.readFileSync(read_path, "UTF-8")).features
const pointsOnly = features.map(f => {
f.properties["_last_edit:timestamp"] = "1970-01-01"
if (f.geometry.type === "Point") {
return f
} else {