forked from MapComplete/MapComplete
		
	Add point-only layer for nature reserves, mark point-only layer as old (so that geometries will show up)
This commit is contained in:
		
							parent
							
								
									b79be77686
								
							
						
					
					
						commit
						135219b5dc
					
				
					 4 changed files with 31 additions and 6 deletions
				
			
		|  | @ -16,7 +16,7 @@ import RegisteringFeatureSource from "./RegisteringFeatureSource"; | ||||||
| 
 | 
 | ||||||
| export default class FeaturePipeline implements FeatureSource { | export default class FeaturePipeline implements FeatureSource { | ||||||
| 
 | 
 | ||||||
|     public features: UIEventSource<{ feature: any; freshness: Date }[]> ; |     public features: UIEventSource<{ feature: any; freshness: Date }[]>; | ||||||
| 
 | 
 | ||||||
|     public readonly name = "FeaturePipeline" |     public readonly name = "FeaturePipeline" | ||||||
| 
 | 
 | ||||||
|  | @ -29,7 +29,7 @@ export default class FeaturePipeline implements FeatureSource { | ||||||
|                 selectedElement: UIEventSource<any>) { |                 selectedElement: UIEventSource<any>) { | ||||||
| 
 | 
 | ||||||
|         const allLoadedFeatures = new UIEventSource<{ feature: any; freshness: Date }[]>([]) |         const allLoadedFeatures = new UIEventSource<{ feature: any; freshness: Date }[]>([]) | ||||||
|          | 
 | ||||||
|         // first we metatag, then we save to get the metatags into storage too
 |         // 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)
 |         // 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 |         const geojsonSources: FeatureSource [] = GeoJsonSource | ||||||
|             .ConstructMultiSource(flayers.data, locationControl) |             .ConstructMultiSource(flayers.data, locationControl) | ||||||
|             .map(geojsonSource => { |             .map(geojsonSource => { | ||||||
|                 let source = new RegisteringFeatureSource(new FeatureDuplicatorPerLayer(flayers, geojsonSource)); |                 let source = new RegisteringFeatureSource( | ||||||
|                 if(!geojsonSource.isOsmCache){ |                     new FeatureDuplicatorPerLayer(flayers, | ||||||
|  |                             geojsonSource | ||||||
|  |                     )); | ||||||
|  |                 if (!geojsonSource.isOsmCache) { | ||||||
|                     source = new MetaTaggingFeatureSource(allLoadedFeatures, source, updater.features); |                     source = new MetaTaggingFeatureSource(allLoadedFeatures, source, updater.features); | ||||||
|                 } |                 } | ||||||
|                 return source |                 return source | ||||||
|  |  | ||||||
|  | @ -175,7 +175,7 @@ export default class GeoJsonSource implements FeatureSource { | ||||||
| 
 | 
 | ||||||
|                 let freshness: Date = time; |                 let freshness: Date = time; | ||||||
|                 if (feature.properties["_last_edit:timestamp"] !== undefined) { |                 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}) |                 newFeatures.push({feature: feature, freshness: freshness}) | ||||||
|  |  | ||||||
|  | @ -27,6 +27,7 @@ | ||||||
|   "defaultBackgroundId": "CartoDB.Positron", |   "defaultBackgroundId": "CartoDB.Positron", | ||||||
|   "layers": [ |   "layers": [ | ||||||
|     { |     { | ||||||
|  |       "#": "Nature reserve with geometry, z>=13", | ||||||
|       "builtin": "nature_reserve", |       "builtin": "nature_reserve", | ||||||
|       "override": { |       "override": { | ||||||
|         "source": { |         "source": { | ||||||
|  | @ -39,7 +40,25 @@ | ||||||
|           "geoJsonZoomLevel": 12, |           "geoJsonZoomLevel": 12, | ||||||
|           "isOsmCache": true |           "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": { |         "icon": { | ||||||
|           "render": "circle:#FE6F32;./assets/themes/natuurpunt/nature_reserve.svg" |           "render": "circle:#FE6F32;./assets/themes/natuurpunt/nature_reserve.svg" | ||||||
|         } |         } | ||||||
|  |  | ||||||
|  | @ -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 features = JSON.parse(fs.readFileSync(read_path, "UTF-8")).features | ||||||
|             const pointsOnly = features.map(f => { |             const pointsOnly = features.map(f => { | ||||||
|  |                  | ||||||
|  |                 f.properties["_last_edit:timestamp"] = "1970-01-01" | ||||||
|  |                  | ||||||
|                 if (f.geometry.type === "Point") { |                 if (f.geometry.type === "Point") { | ||||||
|                     return f |                     return f | ||||||
|                 } else { |                 } else { | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue