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 { | ||||
| 
 | ||||
|     public features: UIEventSource<{ feature: any; freshness: Date }[]> ; | ||||
|     public features: UIEventSource<{ feature: any; freshness: Date }[]>; | ||||
| 
 | ||||
|     public readonly name = "FeaturePipeline" | ||||
| 
 | ||||
|  | @ -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 | ||||
|  |  | |||
|  | @ -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}) | ||||
|  |  | |||
|  | @ -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" | ||||
|         } | ||||
|  |  | |||
|  | @ -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 { | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue