forked from MapComplete/MapComplete
		
	Drop widths theme
This commit is contained in:
		
							parent
							
								
									f386c3a25f
								
							
						
					
					
						commit
						4cb09ba8e7
					
				
					 4 changed files with 0 additions and 341 deletions
				
			
		|  | @ -251,116 +251,6 @@ export default class SimpleMetaTagger { | |||
| 
 | ||||
|         }) | ||||
|     ) | ||||
|     private static carriageWayWidth = new SimpleMetaTagger( | ||||
|         { | ||||
|             keys: ["_width:needed", "_width:needed:no_pedestrians", "_width:difference"], | ||||
|             doc: "Legacy for a specific project calculating the needed width for safe traffic on a road. Only activated if 'width:carriageway' is present" | ||||
|         }, | ||||
|         feature => { | ||||
| 
 | ||||
|             const properties = feature.properties; | ||||
|             if (properties["width:carriageway"] === undefined) { | ||||
|                 return; | ||||
|             } | ||||
| 
 | ||||
|             const carWidth = 2; | ||||
|             const cyclistWidth = 1.5; | ||||
|             const pedestrianWidth = 0.75; | ||||
| 
 | ||||
| 
 | ||||
|             const _leftSideParking = | ||||
|                 new And([new Tag("parking:lane:left", "parallel"), new Tag("parking:lane:right", "no_parking")]); | ||||
|             const _rightSideParking = | ||||
|                 new And([new Tag("parking:lane:right", "parallel"), new Tag("parking:lane:left", "no_parking")]); | ||||
| 
 | ||||
|             const _bothSideParking = new Tag("parking:lane:both", "parallel"); | ||||
|             const _noSideParking = new Tag("parking:lane:both", "no_parking"); | ||||
|             const _otherParkingMode = | ||||
|                 new Or([ | ||||
|                     new Tag("parking:lane:both", "perpendicular"), | ||||
|                     new Tag("parking:lane:left", "perpendicular"), | ||||
|                     new Tag("parking:lane:right", "perpendicular"), | ||||
|                     new Tag("parking:lane:both", "diagonal"), | ||||
|                     new Tag("parking:lane:left", "diagonal"), | ||||
|                     new Tag("parking:lane:right", "diagonal"), | ||||
|                 ]) | ||||
| 
 | ||||
|             const _sidewalkBoth = new Tag("sidewalk", "both"); | ||||
|             const _sidewalkLeft = new Tag("sidewalk", "left"); | ||||
|             const _sidewalkRight = new Tag("sidewalk", "right"); | ||||
|             const _sidewalkNone = new Tag("sidewalk", "none"); | ||||
| 
 | ||||
| 
 | ||||
|             let parallelParkingCount = 0; | ||||
| 
 | ||||
| 
 | ||||
|             const _oneSideParking = new Or([_leftSideParking, _rightSideParking]); | ||||
| 
 | ||||
|             if (_oneSideParking.matchesProperties(properties)) { | ||||
|                 parallelParkingCount = 1; | ||||
|             } else if (_bothSideParking.matchesProperties(properties)) { | ||||
|                 parallelParkingCount = 2; | ||||
|             } else if (_noSideParking.matchesProperties(properties)) { | ||||
|                 parallelParkingCount = 0; | ||||
|             } else if (_otherParkingMode.matchesProperties(properties)) { | ||||
|                 parallelParkingCount = 0; | ||||
|             } else { | ||||
|                 console.log("No parking data for ", properties.name, properties.id) | ||||
|             } | ||||
| 
 | ||||
| 
 | ||||
|             let pedestrianFlowNeeded; | ||||
|             if (_sidewalkBoth.matchesProperties(properties)) { | ||||
|                 pedestrianFlowNeeded = 0; | ||||
|             } else if (_sidewalkNone.matchesProperties(properties)) { | ||||
|                 pedestrianFlowNeeded = 2; | ||||
|             } else if (_sidewalkLeft.matchesProperties(properties) || _sidewalkRight.matchesProperties(properties)) { | ||||
|                 pedestrianFlowNeeded = 1; | ||||
|             } else { | ||||
|                 pedestrianFlowNeeded = -1; | ||||
|             } | ||||
| 
 | ||||
| 
 | ||||
|             let onewayCar = properties.oneway === "yes"; | ||||
|             let onewayBike = properties["oneway:bicycle"] === "yes" || | ||||
|                 (onewayCar && properties["oneway:bicycle"] === undefined) | ||||
| 
 | ||||
|             let cyclingAllowed = | ||||
|                 !(properties.bicycle === "use_sidepath" | ||||
|                     || properties.bicycle === "no"); | ||||
| 
 | ||||
|             let carWidthUsed = (onewayCar ? 1 : 2) * carWidth; | ||||
|             properties["_width:needed:cars"] = Utils.Round(carWidthUsed); | ||||
|             properties["_width:needed:parking"] = Utils.Round(parallelParkingCount * carWidth) | ||||
| 
 | ||||
| 
 | ||||
|             let cyclistWidthUsed = 0; | ||||
|             if (cyclingAllowed) { | ||||
|                 cyclistWidthUsed = (onewayBike ? 1 : 2) * cyclistWidth; | ||||
|             } | ||||
|             properties["_width:needed:cyclists"] = Utils.Round(cyclistWidthUsed) | ||||
| 
 | ||||
| 
 | ||||
|             const width = parseFloat(properties["width:carriageway"]); | ||||
| 
 | ||||
| 
 | ||||
|             const targetWidthIgnoringPedestrians = | ||||
|                 carWidthUsed + | ||||
|                 cyclistWidthUsed + | ||||
|                 parallelParkingCount * carWidthUsed; | ||||
|             properties["_width:needed:no_pedestrians"] = Utils.Round(targetWidthIgnoringPedestrians); | ||||
| 
 | ||||
|             const pedestriansNeed = Math.max(0, pedestrianFlowNeeded) * pedestrianWidth; | ||||
|             const targetWidth = targetWidthIgnoringPedestrians + pedestriansNeed; | ||||
|             properties["_width:needed"] = Utils.Round(targetWidth); | ||||
|             properties["_width:needed:pedestrians"] = Utils.Round(pedestriansNeed) | ||||
| 
 | ||||
| 
 | ||||
|             properties["_width:difference"] = Utils.Round(targetWidth - width); | ||||
|             properties["_width:difference:no_pedestrians"] = Utils.Round(targetWidthIgnoringPedestrians - width); | ||||
| 
 | ||||
|         } | ||||
|     ); | ||||
|     private static currentTime = new SimpleMetaTagger( | ||||
|         { | ||||
|             keys: ["_now:date", "_now:datetime", "_loaded:date", "_loaded:_datetime"], | ||||
|  | @ -396,7 +286,6 @@ export default class SimpleMetaTagger { | |||
|         SimpleMetaTagger.canonicalize, | ||||
|         SimpleMetaTagger.country, | ||||
|         SimpleMetaTagger.isOpen, | ||||
|         SimpleMetaTagger.carriageWayWidth, | ||||
|         SimpleMetaTagger.directionSimplified, | ||||
|         SimpleMetaTagger.currentTime, | ||||
|         SimpleMetaTagger.objectMetaInfo | ||||
|  |  | |||
|  | @ -1,5 +0,0 @@ | |||
| <?xml version="1.0" encoding="UTF-8"?> | ||||
| <svg xmlns="http://www.w3.org/2000/svg" width="50" height="40"> | ||||
|     <path d="M5,20H45M12,12 4,20 12,28M38,12 46,20 38,28" stroke="#000" stroke-width="4" stroke-linejoin="round" | ||||
|           stroke-linecap="round" fill="none"/> | ||||
| </svg> | ||||
| Before Width: | Height: | Size: 273 B | 
|  | @ -1,8 +0,0 @@ | |||
| [ | ||||
|   { | ||||
|     "path": "icon.svg", | ||||
|     "license": "CC0; trivial", | ||||
|     "authors": [], | ||||
|     "sources": [] | ||||
|   } | ||||
| ] | ||||
|  | @ -1,217 +0,0 @@ | |||
| { | ||||
|   "id": "width", | ||||
|   "title": { | ||||
|     "nl": "Straatbreedtes" | ||||
|   }, | ||||
|   "shortDescription": { | ||||
|     "nl": "Is de straat breed genoeg?" | ||||
|   }, | ||||
|   "description": { | ||||
|     "nl": " <h3>De straat is opgebruikt</h3>\n <p>Er is steeds meer druk op de openbare ruimte. Voetgangers, fietsers, steps, auto's, bussen, bestelwagens, buggies, cargobikes, ... willen allemaal hun deel van de openbare ruimte.</p>\n <p>In deze studie nemen we Brugge onder de loep en kijken we hoe breed elke straat is én hoe breed elke straat zou moeten zijn voor een veilig én vlot verkeer.</p>\n <h3>Legende</h3>\n <span style='background: red'>   </span> Straat te smal voor veilig verkeer<br/>\n <span style='background: #0f0'>   </span> Straat is breed genoeg veilig verkeer<br/>\n <span style='background: orange'>   </span> Straat zonder voetpad, te smal als ook voetgangers plaats krijgen<br/>\n <span style='background: lightgrey'>   </span> Woonerf, autoluw, autoloos of enkel plaatselijk verkeer<br/>\n <br/>\n <br/>\n Een gestippelde lijn is een straat waar ook voor fietsers éénrichtingsverkeer geldt.<br/>\n Klik op een straat om meer informatie te zien.\n <h3>Hoe gaan we verder?</h3>\n Verschillende ingrepen kunnen de stad teruggeven aan de inwoners en de stad leefbaarder en levendiger maken.<br/>\n Denk aan:\n <ul>\n <li>De autovrije zone's uitbreiden</li>\n <li>De binnenstad fietszone maken</li>\n <li>Het aantal woonerven uitbreiden</li>\n <li>Grotere auto's meer belasten - ze nemen immers meer parkeerruimte in.</li>\n <li>Laat toeristen verplicht parkeren onder het zand; een (fiets)taxi kan hen naar hun hotel brengen</li>\n <li>Voorzie in elke straat enkele parkeerplaatsen voor kortparkeren. Zo kunnen leveringen, iemand afzetten,... gebeuren zonder op het voetpad en fietspad te parkeren</li>\n </ul>" | ||||
|   }, | ||||
|   "language": [ | ||||
|     "nl" | ||||
|   ], | ||||
|   "hideFromOverview": true, | ||||
|   "enableUserBadge": false, | ||||
|   "enableShareScreen": false, | ||||
|   "enableMoreQuests": false, | ||||
|   "enableLayers": false, | ||||
|   "enableSearch": false, | ||||
|   "enableGeolocation": false, | ||||
|   "maintainer": "", | ||||
|   "icon": "./assets/themes/widths/icon.svg", | ||||
|   "version": "0", | ||||
|   "startLat": 51.20875, | ||||
|   "startLon": 3.22435, | ||||
|   "startZoom": 14, | ||||
|   "widenFactor": 0.05, | ||||
|   "socialImage": "", | ||||
|   "layers": [ | ||||
|     { | ||||
|       "id": "widths", | ||||
|       "name": { | ||||
|         "nl": "Straten met een breedte" | ||||
|       }, | ||||
|       "minzoom": 14, | ||||
|       "source": { | ||||
|         "osmTags": { | ||||
|           "and": [ | ||||
|             "width:carriageway~*" | ||||
|           ] | ||||
|         } | ||||
|       }, | ||||
|       "titleIcons": [], | ||||
|       "title": { | ||||
|         "render": { | ||||
|           "nl": "{name}" | ||||
|         }, | ||||
|         "condition": { | ||||
|           "and": [] | ||||
|         }, | ||||
|         "mappings": [ | ||||
|           { | ||||
|             "if": { | ||||
|               "and": [ | ||||
|                 "name=" | ||||
|               ] | ||||
|             }, | ||||
|             "then": { | ||||
|               "nl": "Naamloos segmet" | ||||
|             } | ||||
|           } | ||||
|         ] | ||||
|       }, | ||||
|       "tagRenderings": [ | ||||
|         { | ||||
|           "render": "Deze straat is <b>{width:carriageway}m</b> breed", | ||||
|           "question": "Hoe breed is deze straat?", | ||||
|           "freeform": { | ||||
|             "key": "width:carriageway", | ||||
|             "type": "length", | ||||
|             "helperArgs": [ | ||||
|               21, | ||||
|               "map" | ||||
|             ] | ||||
|           } | ||||
|         }, | ||||
|         { | ||||
|           "render": "Deze straat heeft <span class='alert'>{_width:difference}m</span> te weinig:", | ||||
|           "mappings": [ | ||||
|             { | ||||
|               "if": { | ||||
|                 "or": [ | ||||
|                   "_width:difference~-.*", | ||||
|                   "_width:difference=0.0" | ||||
|                 ] | ||||
|               }, | ||||
|               "then": "Deze straat is breed genoeg:" | ||||
|             } | ||||
|           ] | ||||
|         }, | ||||
|         { | ||||
|           "render": "<b>{_width:needed:cars}m</b> voor het autoverkeer", | ||||
|           "mappings": [ | ||||
|             { | ||||
|               "if": "oneway=yes", | ||||
|               "then": "<b>{_width:needed:cars}m</b> voor het éénrichtings-autoverkeer" | ||||
|             }, | ||||
|             { | ||||
|               "if": "oneway=no", | ||||
|               "then": "<b>{_width:needed:cars}m</b> voor het tweerichtings-autoverkeer" | ||||
|             } | ||||
|           ] | ||||
|         }, | ||||
|         { | ||||
|           "render": "<b>{_width:needed:parking}m</b> voor het geparkeerde wagens", | ||||
|           "condition": "_width:needed:parking!=0.0" | ||||
|         }, | ||||
|         { | ||||
|           "render": "<b>{_width:needed:cyclists}m</b> voor fietsers", | ||||
|           "mappings": [ | ||||
|             { | ||||
|               "if": "bicycle=use_sidepath", | ||||
|               "then": "Fietsers hebben hier een vrijliggend fietspad en worden dus niet meegerekend" | ||||
|             }, | ||||
|             { | ||||
|               "if": "oneway:bicycle=yes", | ||||
|               "then": "<b>{_width:needed:cyclists}m</b> voor fietsers, die met de rijrichting mee moeten" | ||||
|             } | ||||
|           ] | ||||
|         }, | ||||
|         { | ||||
|           "render": "<b>{_width:needed:pedestrians}m</b> voor voetgangers", | ||||
|           "condition": "_width:needed:pedestrians!=0.0", | ||||
|           "mappings": [ | ||||
|             { | ||||
|               "if": { | ||||
|                 "or": [ | ||||
|                   "sidewalk=none", | ||||
|                   "sidewalk=no" | ||||
|                 ] | ||||
|               }, | ||||
|               "then": "<b>{_width:needed:pedestrians}m</b> voor voetgangers: er zijn hier geen voetpaden" | ||||
|             }, | ||||
|             { | ||||
|               "if": { | ||||
|                 "or": [ | ||||
|                   "sidewalk=left", | ||||
|                   "sidewalk=right" | ||||
|                 ] | ||||
|               }, | ||||
|               "then": "<b>{_width:needed:pedestrians}m</b> voor voetgangers: er is slechts aan één kant een voetpad" | ||||
|             } | ||||
|           ] | ||||
|         }, | ||||
|         { | ||||
|           "render": "<span style='border: 1px solid black; border-radius: 0.5em; padding: 0.25em;'><b>{_width:needed}m</b> nodig in het totaal</span>" | ||||
|         } | ||||
|       ], | ||||
|       "icon": { | ||||
|         "render": "./assets/themes/widths/icon.svg" | ||||
|       }, | ||||
|       "width": { | ||||
|         "render": "4" | ||||
|       }, | ||||
|       "iconSize": { | ||||
|         "render": "40,40,center" | ||||
|       }, | ||||
|       "color": { | ||||
|         "render": "#00f", | ||||
|         "mappings": [ | ||||
|           { | ||||
|             "if": { | ||||
|               "or": [ | ||||
|                 "access=destination", | ||||
|                 "highway=living_street", | ||||
|                 "highway=pedestrian", | ||||
|                 "motor_vehicle=no", | ||||
|                 "motor_vehicle=destination" | ||||
|               ] | ||||
|             }, | ||||
|             "then": "lightgrey" | ||||
|           }, | ||||
|           { | ||||
|             "if": "_width:difference~-.*", | ||||
|             "then": "#0f0" | ||||
|           }, | ||||
|           { | ||||
|             "if": { | ||||
|               "and": [ | ||||
|                 "_width:difference!~-.*", | ||||
|                 "_width:difference:no_pedestrians~-.*" | ||||
|               ] | ||||
|             }, | ||||
|             "then": "orange" | ||||
|           }, | ||||
|           { | ||||
|             "if": "_width:difference!~-.*", | ||||
|             "then": "#f00" | ||||
|           } | ||||
|         ] | ||||
|       }, | ||||
|       "dashArray": { | ||||
|         "render": "", | ||||
|         "mappings": [ | ||||
|           { | ||||
|             "if": { | ||||
|               "and": [ | ||||
|                 "oneway=yes", | ||||
|                 { | ||||
|                   "or": [ | ||||
|                     "oneway:bicycle=yes", | ||||
|                     "oneway:bicycle=" | ||||
|                   ] | ||||
|                 } | ||||
|               ] | ||||
|             }, | ||||
|             "then": "5 6" | ||||
|           } | ||||
|         ] | ||||
|       }, | ||||
|       "presets": [] | ||||
|     } | ||||
|   ], | ||||
|   "roamingRenderings": [], | ||||
|   "defaultBackgroundId": "Stadia.AlidadeSmoothDark" | ||||
| } | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue