forked from MapComplete/MapComplete
		
	Add ids to layers in themes
This commit is contained in:
		
							parent
							
								
									39166ff806
								
							
						
					
					
						commit
						0ca19a5a03
					
				
					 10 changed files with 95 additions and 60 deletions
				
			
		|  | @ -342,7 +342,8 @@ | |||
|                 "nb_NO": "Flisarbeid" | ||||
|               } | ||||
|             } | ||||
|           ] | ||||
|           ], | ||||
|           "id": "artwork-artwork_type" | ||||
|         }, | ||||
|         { | ||||
|           "question": { | ||||
|  | @ -369,7 +370,8 @@ | |||
|           }, | ||||
|           "freeform": { | ||||
|             "key": "artist_name" | ||||
|           } | ||||
|           }, | ||||
|           "id": "artwork-artist_name" | ||||
|         }, | ||||
|         { | ||||
|           "question": { | ||||
|  | @ -398,7 +400,8 @@ | |||
|           "freeform": { | ||||
|             "key": "website", | ||||
|             "type": "url" | ||||
|           } | ||||
|           }, | ||||
|           "id": "artwork-website" | ||||
|         }, | ||||
|         { | ||||
|           "question": { | ||||
|  | @ -426,7 +429,8 @@ | |||
|           "freeform": { | ||||
|             "key": "wikidata", | ||||
|             "type": "wikidata" | ||||
|           } | ||||
|           }, | ||||
|           "id": "artwork-wikidata" | ||||
|         } | ||||
|       ] | ||||
|     } | ||||
|  |  | |||
|  | @ -138,7 +138,8 @@ | |||
|           }, | ||||
|           "freeform": { | ||||
|             "key": "name" | ||||
|           } | ||||
|           }, | ||||
|           "id": "caravansites-name" | ||||
|         }, | ||||
|         { | ||||
|           "question": { | ||||
|  | @ -226,7 +227,8 @@ | |||
|             "and": [ | ||||
|               "fee=yes" | ||||
|             ] | ||||
|           } | ||||
|           }, | ||||
|           "id": "caravansites-charge" | ||||
|         }, | ||||
|         { | ||||
|           "question": { | ||||
|  | @ -295,7 +297,8 @@ | |||
|           "freeform": { | ||||
|             "key": "capacity", | ||||
|             "type": "pnat" | ||||
|           } | ||||
|           }, | ||||
|           "id": "caravansites-capacity" | ||||
|         }, | ||||
|         { | ||||
|           "question": { | ||||
|  | @ -491,7 +494,8 @@ | |||
|             "zh_Hant": "這個地方有網站嗎?", | ||||
|             "fr": "Ce lieu a-t’il un site internet ?", | ||||
|             "pt_BR": "Este lugar tem um website?" | ||||
|           } | ||||
|           }, | ||||
|           "id": "caravansites-website" | ||||
|         }, | ||||
|         { | ||||
|           "question": { | ||||
|  | @ -575,7 +579,8 @@ | |||
|           "freeform": { | ||||
|             "key": "description", | ||||
|             "type": "text" | ||||
|           } | ||||
|           }, | ||||
|           "id": "caravansites-description" | ||||
|         }, | ||||
|         "questions", | ||||
|         "reviews" | ||||
|  | @ -749,7 +754,8 @@ | |||
|             "and": [ | ||||
|               "fee=yes" | ||||
|             ] | ||||
|           } | ||||
|           }, | ||||
|           "id": "dumpstations-charge" | ||||
|         }, | ||||
|         { | ||||
|           "question": { | ||||
|  | @ -957,7 +963,8 @@ | |||
|           }, | ||||
|           "freeform": { | ||||
|             "key": "network" | ||||
|           } | ||||
|           }, | ||||
|           "id": "dumpstations-network" | ||||
|         } | ||||
|       ], | ||||
|       "icon": { | ||||
|  |  | |||
|  | @ -138,7 +138,8 @@ | |||
|           }, | ||||
|           "freeform": { | ||||
|             "key": "name" | ||||
|           } | ||||
|           }, | ||||
|           "id": "climbing_club-name" | ||||
|         }, | ||||
|         { | ||||
|           "render": "{minimap(18): height: 5rem; overflow: hidden; border-radius:3rem; }" | ||||
|  | @ -268,7 +269,6 @@ | |||
|           "render": "{minimap(18): height: 5rem; overflow: hidden; border-radius:3rem; }" | ||||
|         }, | ||||
|         { | ||||
|           "#": "name", | ||||
|           "render": { | ||||
|             "en": "<strong>{name}</strong>", | ||||
|             "nl": "<strong>{name}</strong>", | ||||
|  | @ -288,7 +288,8 @@ | |||
|           }, | ||||
|           "freeform": { | ||||
|             "key": "name" | ||||
|           } | ||||
|           }, | ||||
|           "id": "name" | ||||
|         }, | ||||
|         "website", | ||||
|         "phone", | ||||
|  | @ -361,7 +362,6 @@ | |||
|           "render": "{minimap(18): height: 5rem; overflow: hidden; border-radius:3rem; }" | ||||
|         }, | ||||
|         { | ||||
|           "#": "Name", | ||||
|           "render": { | ||||
|             "en": "<strong>{name}</strong>", | ||||
|             "nl": "<strong>{name}</strong>", | ||||
|  | @ -401,10 +401,10 @@ | |||
|                 "fr": "Cette voie n’a pas de nom" | ||||
|               } | ||||
|             } | ||||
|           ] | ||||
|           ], | ||||
|           "id": "Name" | ||||
|         }, | ||||
|         { | ||||
|           "#": "Length", | ||||
|           "question": { | ||||
|             "en": "How long is this climbing route (in meters)?", | ||||
|             "nl": "Hoe lang is deze klimroute (in meters)?", | ||||
|  | @ -423,10 +423,10 @@ | |||
|           "freeform": { | ||||
|             "key": "climbing:length", | ||||
|             "type": "pnat" | ||||
|           } | ||||
|           }, | ||||
|           "id": "Length" | ||||
|         }, | ||||
|         { | ||||
|           "#": "Difficulty", | ||||
|           "question": { | ||||
|             "en": "What is the difficulty of this climbing route according to the french/belgian system?", | ||||
|             "nl": "Hoe moeilijk is deze klimroute volgens het Franse/Belgische systeem?", | ||||
|  | @ -443,10 +443,10 @@ | |||
|           }, | ||||
|           "freeform": { | ||||
|             "key": "climbing:grade:french" | ||||
|           } | ||||
|           }, | ||||
|           "id": "Difficulty" | ||||
|         }, | ||||
|         { | ||||
|           "#": "Bolts", | ||||
|           "question": { | ||||
|             "en": "How much bolts does this route have before reaching the moulinette?", | ||||
|             "fr": "Combien de prises cette voie possède avant d’atteindre la moulinette ?" | ||||
|  | @ -478,25 +478,26 @@ | |||
|                 "fr": "Cette voie n’a pas de prises" | ||||
|               } | ||||
|             } | ||||
|           ] | ||||
|           ], | ||||
|           "id": "Bolts" | ||||
|         }, | ||||
|         { | ||||
|           "#": "Description", | ||||
|           "question": "Is there other relevant info?", | ||||
|           "render": "<h3>Description</h3><br/>{description}", | ||||
|           "freeform": { | ||||
|             "key": "description" | ||||
|           } | ||||
|           }, | ||||
|           "id": "Description" | ||||
|         }, | ||||
|         { | ||||
|           "#": "Rock type", | ||||
|           "render": { | ||||
|             "en": "The rock type is {_embedding_features_with_rock:rock} as stated <a href='#{_embedding_features_with_rock:id}'>on the surrounding crag</a>", | ||||
|             "fr": "Le type de roche est {_embedding_features_with_rock:rock} selon <a href='#{_embedding_features_with_rock:id}'>le mur</a>" | ||||
|           }, | ||||
|           "freeform": { | ||||
|             "key": "_embedding_features_with_rock:rock" | ||||
|           } | ||||
|           }, | ||||
|           "id": "Rock type" | ||||
|         }, | ||||
|         "reviews" | ||||
|       ], | ||||
|  | @ -621,31 +622,30 @@ | |||
|           "render": "{minimap(18, id, _contained_climbing_route_ids): height: 9rem; overflow: hidden; border-radius:3rem; }" | ||||
|         }, | ||||
|         { | ||||
|           "#": "Contained routes length hist", | ||||
|           "render": { | ||||
|             "en": "<h3>Length overview</h3>{histogram(_length_hist)}", | ||||
|             "fr": "<h3>Résumé de longueur</h3>{histogram(_length_hist)}" | ||||
|           }, | ||||
|           "condition": "_length_hist!~\\[\\]" | ||||
|           "condition": "_length_hist!~\\[\\]", | ||||
|           "id": "Contained routes length hist" | ||||
|         }, | ||||
|         { | ||||
|           "#": "Contained routes hist", | ||||
|           "render": { | ||||
|             "en": "<h3>Difficulties overview</h3>{histogram(_difficulty_hist)}", | ||||
|             "fr": "<h3>Résumé des difficultés</h3>{histogram(_difficulty_hist)}" | ||||
|           }, | ||||
|           "condition": "_difficulty_hist!~\\[\\]" | ||||
|           "condition": "_difficulty_hist!~\\[\\]", | ||||
|           "id": "Contained routes hist" | ||||
|         }, | ||||
|         { | ||||
|           "#": "Containe {_contained_climbing_routes_count} routes", | ||||
|           "render": { | ||||
|             "en": "<h3>Contains {_contained_climbing_routes_count} routes</h3> <ul>{_contained_climbing_routes}</ul>", | ||||
|             "fr": "<h3>Contient {_contained_climbing_routes_count} voies</h3> <ul>{_contained_climbing_routes}</ul>" | ||||
|           }, | ||||
|           "condition": "_contained_climbing_routes~*" | ||||
|           "condition": "_contained_climbing_routes~*", | ||||
|           "id": "Containe {_contained_climbing_routes_count} routes" | ||||
|         }, | ||||
|         { | ||||
|           "#": "name", | ||||
|           "render": { | ||||
|             "en": "<strong>{name}</strong>", | ||||
|             "nl": "<strong>{name}</strong>", | ||||
|  | @ -682,10 +682,10 @@ | |||
|                 "fr": "Ce site n’a pas de nom" | ||||
|               } | ||||
|             } | ||||
|           ] | ||||
|           ], | ||||
|           "id": "name" | ||||
|         }, | ||||
|         { | ||||
|           "#": "Type", | ||||
|           "question": "What kind of climbing opportunity is this?", | ||||
|           "mappings": [ | ||||
|             { | ||||
|  | @ -706,10 +706,10 @@ | |||
|               "if": "climbing=area", | ||||
|               "then": "A climbing area with one or more climbing crags and/or boulders" | ||||
|             } | ||||
|           ] | ||||
|           ], | ||||
|           "id": "Type" | ||||
|         }, | ||||
|         { | ||||
|           "#": "Rock type (crag/rock/cliff only)", | ||||
|           "question": { | ||||
|             "en": "What is the rock type here?", | ||||
|             "fr": "Quel est le type de roche ?" | ||||
|  | @ -737,7 +737,8 @@ | |||
|               "natural=cliff", | ||||
|               "natural=bare_rock" | ||||
|             ] | ||||
|           } | ||||
|           }, | ||||
|           "id": "Rock type (crag/rock/cliff only)" | ||||
|         }, | ||||
|         "reviews" | ||||
|       ], | ||||
|  |  | |||
|  | @ -33,14 +33,16 @@ | |||
|           "question": "What is the name of this cycle highway?", | ||||
|           "freeform": { | ||||
|             "key": "name" | ||||
|           } | ||||
|           }, | ||||
|           "id": "cycle_highways-name" | ||||
|         }, | ||||
|         { | ||||
|           "render": "Referentienummer is <b>{ref}</b>", | ||||
|           "question": "What is the reference number of this cycle highway?", | ||||
|           "freeform": { | ||||
|             "key": "ref" | ||||
|           } | ||||
|           }, | ||||
|           "id": "cycle_highways-ref" | ||||
|         }, | ||||
|         { | ||||
|           "render": "The current state of this link is {state}", | ||||
|  | @ -84,7 +86,8 @@ | |||
|               "if": "state=", | ||||
|               "then": "This link is operational and signposted" | ||||
|             } | ||||
|           ] | ||||
|           ], | ||||
|           "id": "cycle_highways-state" | ||||
|         }, | ||||
|         { | ||||
|           "render": "This part is {_length:km}km long" | ||||
|  |  | |||
|  | @ -125,7 +125,8 @@ | |||
|           "freeform": { | ||||
|             "type": "direction", | ||||
|             "key": "direction" | ||||
|           } | ||||
|           }, | ||||
|           "id": "facadegardens-direction" | ||||
|         }, | ||||
|         { | ||||
|           "mappings": [ | ||||
|  | @ -241,7 +242,8 @@ | |||
|           "freeform": { | ||||
|             "key": "start_date", | ||||
|             "type": "text" | ||||
|           } | ||||
|           }, | ||||
|           "id": "facadegardens-start_date" | ||||
|         }, | ||||
|         { | ||||
|           "mappings": [ | ||||
|  | @ -355,7 +357,8 @@ | |||
|           "freeform": { | ||||
|             "key": "description", | ||||
|             "type": "text" | ||||
|           } | ||||
|           }, | ||||
|           "id": "facadegardens-description" | ||||
|         } | ||||
|       ], | ||||
|       "icon": { | ||||
|  |  | |||
|  | @ -101,7 +101,8 @@ | |||
|           }, | ||||
|           "freeform": { | ||||
|             "key": "species:nl" | ||||
|           } | ||||
|           }, | ||||
|           "id": "fruitboom-species:nl" | ||||
|         }, | ||||
|         { | ||||
|           "render": { | ||||
|  | @ -117,7 +118,8 @@ | |||
|             "and": [ | ||||
|               "species:nl~*" | ||||
|             ] | ||||
|           } | ||||
|           }, | ||||
|           "id": "fruitboom-taxon" | ||||
|         }, | ||||
|         { | ||||
|           "render": { | ||||
|  | @ -128,7 +130,8 @@ | |||
|           }, | ||||
|           "freeform": { | ||||
|             "key": "description" | ||||
|           } | ||||
|           }, | ||||
|           "id": "fruitboom-description" | ||||
|         }, | ||||
|         { | ||||
|           "render": { | ||||
|  | @ -139,7 +142,8 @@ | |||
|           }, | ||||
|           "freeform": { | ||||
|             "key": "ref" | ||||
|           } | ||||
|           }, | ||||
|           "id": "fruitboom-ref" | ||||
|         } | ||||
|       ], | ||||
|       "icon": { | ||||
|  |  | |||
|  | @ -76,7 +76,8 @@ | |||
|           }, | ||||
|           "freeform": { | ||||
|             "key": "name" | ||||
|           } | ||||
|           }, | ||||
|           "id": "hackerspaces-name" | ||||
|         }, | ||||
|         "website", | ||||
|         "email", | ||||
|  | @ -103,7 +104,8 @@ | |||
|                 "en": "Opened 24/7" | ||||
|               } | ||||
|             } | ||||
|           ] | ||||
|           ], | ||||
|           "id": "hackerspaces-opening_hours" | ||||
|         }, | ||||
|         "wheelchair-access", | ||||
|         { | ||||
|  | @ -143,7 +145,8 @@ | |||
|           "freeform": { | ||||
|             "key": "start_date", | ||||
|             "type": "date" | ||||
|           } | ||||
|           }, | ||||
|           "id": "hackerspaces-start_date" | ||||
|         } | ||||
|       ], | ||||
|       "icon": { | ||||
|  |  | |||
|  | @ -111,7 +111,8 @@ | |||
|           "render": "This shop is called <i>{name}</i>", | ||||
|           "freeform": { | ||||
|             "key": "name" | ||||
|           } | ||||
|           }, | ||||
|           "id": "shops-name" | ||||
|         }, | ||||
|         { | ||||
|           "render": { | ||||
|  | @ -220,7 +221,8 @@ | |||
|                 "ja": "自動車ディーラー" | ||||
|               } | ||||
|             } | ||||
|           ] | ||||
|           ], | ||||
|           "id": "shops-shop" | ||||
|         }, | ||||
|         { | ||||
|           "render": { | ||||
|  | @ -241,7 +243,8 @@ | |||
|           "freeform": { | ||||
|             "key": "phone", | ||||
|             "type": "phone" | ||||
|           } | ||||
|           }, | ||||
|           "id": "shops-phone" | ||||
|         }, | ||||
|         { | ||||
|           "render": { | ||||
|  | @ -262,7 +265,8 @@ | |||
|           "freeform": { | ||||
|             "key": "website", | ||||
|             "type": "url" | ||||
|           } | ||||
|           }, | ||||
|           "id": "shops-website" | ||||
|         }, | ||||
|         { | ||||
|           "render": { | ||||
|  | @ -282,7 +286,8 @@ | |||
|           "freeform": { | ||||
|             "key": "email", | ||||
|             "type": "email" | ||||
|           } | ||||
|           }, | ||||
|           "id": "shops-email" | ||||
|         }, | ||||
|         { | ||||
|           "render": { | ||||
|  | @ -301,7 +306,8 @@ | |||
|           "freeform": { | ||||
|             "key": "opening_hours", | ||||
|             "type": "opening_hours" | ||||
|           } | ||||
|           }, | ||||
|           "id": "shops-opening_hours" | ||||
|         }, | ||||
|         "questions", | ||||
|         "reviews" | ||||
|  |  | |||
|  | @ -172,7 +172,7 @@ | |||
|           } | ||||
|         }, | ||||
|         { | ||||
|           "id":"walk-type", | ||||
|           "id": "walk-type", | ||||
|           "mappings": [ | ||||
|             { | ||||
|               "if": "route=iwn", | ||||
|  |  | |||
|  | @ -14,6 +14,10 @@ import {LayerConfigJson} from "../Models/ThemeConfig/Json/LayerConfigJson"; | |||
|  * In place fix | ||||
|  */ | ||||
| function fixLayerConfig(config: LayerConfigJson) : void{ | ||||
|     if(config.tagRenderings === undefined){ | ||||
|         return | ||||
|     } | ||||
|      | ||||
|     for (const tagRendering of config.tagRenderings) { | ||||
|         if(tagRendering["#"] !== undefined){ | ||||
|             tagRendering["id"] = tagRendering["#"] | ||||
|  | @ -32,7 +36,7 @@ for (const layerFile of layerFiles) { | |||
|     fixLayerConfig(layerFile.parsed) | ||||
|     writeFileSync(layerFile.path, JSON.stringify(layerFile.parsed, null, "    ")) | ||||
| } | ||||
| /* | ||||
| 
 | ||||
| const themeFiles = ScriptUtils.getThemeFiles() | ||||
| for (const themeFile of themeFiles) { | ||||
|     for (const layerConfig of themeFile.parsed.layers ?? []) { | ||||
|  | @ -42,6 +46,6 @@ for (const themeFile of themeFiles) { | |||
|         // @ts-ignore
 | ||||
|         fixLayerConfig(layerConfig) | ||||
|     } | ||||
|   //  writeFileSync(themeFile.path, JSON.stringify(themeFile.parsed, null, "    "))
 | ||||
|     writeFileSync(themeFile.path, JSON.stringify(themeFile.parsed, null, "  ")) | ||||
| } | ||||
| //*/
 | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue