ADFC mrules

From OpenStreetMap Wiki
Jump to: navigation, search

Der Sourcecode der Landshut Radlrouten Rulefile fuer Maperitive:

// Version vom 05.11.2011
properties
	map-background-color	: #F1EEE8
	map-background-opacity	: 1
	map-sea-color : #B5D0D0
	font-weight : bold
	font-family : Verdana
	text-max-width : 7
	text-halo-width : 25%
	text-halo-opacity : 0.75
	text-align-horizontal : center
	text-align-vertical : center
	font-stretch : 0.9
	map.rendering.lflp.max-compression : 0.7
	map.rendering.lflp.min-buffer-space : 1
	map.rendering.lflp.max-allowed-corner-angle : 120
		
features
	points, areas
		bicycle parking : amenity=bicycle_parking
		mini roundabout : highway=mini_roundabout
		gate : barrier=gate
		bollard : barrier=bollard

	// These are not shown on Mapnik
		puffin : crossing_ref=puffin

	areas
		building : building=yes
		pedestrian : highway=pedestrian
		beach : natural=beach
		water : natural=water OR waterway=riverbank OR landuse=reservoir OR landuse=basin
		village green : landuse=village_green
		forest : landuse=forest OR natural=wood
		farm : landuse=farm
		grass : landuse=grass
		fell : natural=fell
		glacier : natural=glacier
		national park : boundary=national_park
		allotments : landuse=allotments
		academic : node[@isOneOf(amenity, university, college, school)] area[@isOneOf(amenity, university, college, school)]
		meadow : natural=meadow OR landuse=meadow
		nature reserve : leisure=nature_reserve
		playground : leisure=playground
		car park: amenity=parking
		track : leisure=track
		graveyard : amenity=grave_yard OR landuse=cemetery
		military : landuse=military OR military=barracks 
		park : leisure=park
		leisure garden : leisure=garden
		leisure pitch : leisure=pitch
		leisure stadium : leisure=stadium
		landuse retail : landuse=retail
		landuse industrial : landuse=industrial
		commercial area : landuse=commercial
		residential area : landuse=residential
		aeroway apron : aeroway=apron
		aeroway terminal : aeroway=terminal
		
	lines
		tick : line=tick
		tick label : line=tick_label
		cycleway left track : cycleway:left=track OR cycleway=track OR cycleway=both
		cycleway right track : cycleway:right=track OR cycleway=track OR cycleway=both
		bicycle_road : bicycle_road=yes
		highway footway : highway=footway
		highway cycleway : highway=cycleway
		highway path : highway=path
// hier definieren wir die Fahrradrouten (ncn = Nationale, rcn = regionale (Bayernweit), lcn = lokale (Stadt/Lkr)
// die lokalen unterscheiden wir nach dem operator Tag, das macht im Moment aber unerwartete Probleme...
// nach entfernen der Leerschritte im Tag geht es, aber ist das Sinn der Sache?
		adfc route : relation[type=route AND route=bicycle AND network=lcn AND operator=ADFC_Landshut]
		stadt route : relation[type=route AND route=bicycle AND network=lcn AND @isMatch(operator,"Stadt_Landshut")]
		ncn route : relation[type=route AND route=bicycle AND network=ncn]
		rcn route : relation[type=route AND route=bicycle AND network=rcn]
		lcn route : relation[type=route AND route=bicycle AND network=lcn] 
		cycling route : relation[type=route AND route=bicycle]
		coastline : natural=coastline
		river : waterway=river 
		stream : waterway=stream
		canal : waterway=canal
		drain : waterway=drain
		railway : railway=rail
		line barrier : barrier=wall OR barrier=fence
		highway motorway : highway=motorway
		highway motorway link : highway=motorway_link
		highway trunk : highway=trunk
		highway trunk link: highway=trunk_link
		highway primary link : highway=primary_link
		highway primary : highway=primary
		highway secondary : highway=secondary
		highway tertiary : highway=tertiary
		highway unclassified : highway=unclassified
		highway residential : highway=residential
		highway living street : highway=living_street
		highway service : highway=service
		highway pedestrian : highway=pedestrian
		highway track : highway=track
		highway private : access=private AND highway
		highway steps : highway=steps
		bridge foot : bridge=yes AND (foot=yes OR highway=footway)
		historic citywalls : historic=citywalls OR historic=city_wall

		aeroway runway : aeroway=runway
		aeroway taxiway : aeroway=taxiway

	points
		place city : place=city
		place town : place=town
		place village : place=village
		place hamlet : place=hamlet
		place suburb : place=suburb

rules

	target : $featuretype(point)
		if : place*
			define
				font-weight : bold
	
			if : *city
				define
					font-size : 6:8;14:20
					min-zoom : 6
					max-zoom : 14
			elseif : *town
				define
					font-size : 9:8;12:10;20:20
					min-zoom : 9
			elseif : *village
				define
					font-size : 12:10;20:20
					min-zoom : 12
			elseif : *hamlet
				define
					font-size : 14:8;20:16
					min-zoom : 14
			elseif : *suburb
				define
					font-size : 13:10;20:20
					min-zoom : 13
					text-color : white black 50%
			draw : text

	target : playground
		define
			fill-color : #CCFEF0
			line-style : none
		draw : fill
		define
			line-color : #ADCCB5
			line-width : 1
		draw : line
		define
			min-zoom : 17
		draw : text

	target : $featuretype(area)
		define
			line-style : none
			line-width : 1
		if : forest
			define
				min-zoom : 9
				fill-color : #8DC56C white 50%
		elseif : pedestrian
			define
				min-zoom : 13
				fill-color : blue white 85%
		elseif : beach
			define
				min-zoom : 10
				fill-color : #FEFEC0
		elseif : farm
			define
				min-zoom : 9
				fill-color : #E9D8BD white 50%
		elseif : fell
			define
				fill-color : #C5FF5B black 10%
		elseif : water
			define
				fill-color : #B5D0D0
		elseif : residential area
			define
				fill-color : #DCDCDC white 50%
		elseif : grass
			define
				fill-color : #CFECA8 white 50%
		elseif : allotments
			define
				fill-color : #C8B084 white 50%
		elseif : meadow
			define
				fill-color : #CFECA8 white 50%
		elseif : nature reserve
			define
				fill-color : #ABDE96 white 50%
		elseif : car park
			define
				fill-color : #F6EEB7 white 50%
		elseif : park
			define
				fill-color : #C0F6B0 white 50%
		elseif : leisure garden
			define
				fill-color : #CFECA8 white 50%
		elseif : graveyard
			define
				fill-color : #A9CAAE white 50%
		elseif : building
			define
				fill-color : #BCA9A9 white 50%
		elseif : leisure pitch
			define
				fill-color : #89D2AE white 50%
		elseif : leisure stadium
			define
				fill-color : #33CC99 white 50%
		elseif : track
			define
				fill-color : #74DCBA
		elseif : village green
			define
				fill-color : #CFECA8 white 50%
		elseif : landuse retail
			define
				fill-color : #F0D9D9
				line-color : #F4A19E
			draw : line
		elseif : landuse industrial
			define
				fill-color : #DFD1D6 white 50%
		elseif : commercial area
			define
				fill-color : #EFC8C8 white 50%
		elseif : military
			define
				fill-color : #FE9898 white 50%
		elseif : aeroway*
			define
				fill-color : #E9D1FE
		elseif : glacier
			define
				fill-color : #DDECEC
				line-style : dash
				line-color : #DDECEC black 10%
		else
			stop
		draw : fill
		define
			min-zoom : 17
		draw : text

// Draw the cycling-routes over all ways:
// basic rule for unknown routes:

	target : * route
		define
			line-color : #FF00FF
			line-style : solid
			line-opacity : 1
			line-width : 11:3;15:4;17:8
		if : adfc*
			define
				line-opacity : 0.85
				line-color : #EE7F00
		if : stadt*
			define
				line-opacity : 0.85
				line-color : #004B7C
		if : ncn* 
			define
				line-opacity : 0.95
				line-color : green
		if : rcn*
			define
				line-opacity : 0.85
				line-color : red
		draw : line
//		draw : text
		
	target : aeroway runway
		define
			min-zoom : 11
			line-color : #BBBBCC
			line-width : 11:2;15:20
		draw : line
		
	target : aeroway taxiway
		define
			min-zoom : 11
			line-color : #BBBBCC
			line-width : 11:1;15:6
		draw : line
		
	target : glacier
		define
			min-zoom : 10
			text-color : #A3A3FE
		draw : text
		
	target : academic
		define
			fill-color : #F0F0D8
			line-style : none
		draw : fill
		define
			line-color : #E5D2CC
			line-width : 1
		draw : line
			

	target : national park
		define
			fill-color : #8DC56C
			fill-opacity : 0.2
			line-style : none
		draw : fill
		define
			line-color : #8DC56C black 20%
			line-opacity : 0.5
			line-width : 3
			line-style : dash
			font-size : 3:3;12:12
			text-color : green
			font-weight : normal
		draw : line
		draw : text


	target : tick
		define
			min-zoom : 13
			line-color : black
			line-width : 13:1;18:4
			line-style : solid
		draw : line

	target : tick label
		define
			min-zoom : 13
			font-size : 13:8;16:14;18:20;19:18
			text : label
		draw : text

	target : railway
		define
			min-zoom : 13
			line-color : gray
			line-width : 2
		draw : line
		define
			min-zoom : 13
			line-style : dashlong
			line-color : white
			line-width : 2
			border-style : solid
			border-color : gray
			border-width : 25%
		draw : line
		define
			min-zoom : 6
			max-zoom : 13
			line-style : none
			line-color : white black 30%
			line-width : 6:1;8:1;12:1.5
		draw : line

	target : highway private
		define
			min-zoom : 15
			line-width : 4
			line-style : dash
			line-color : #F7D4D4
		draw : line

	target : cycleway *track
		define
			min-zoom : 13
			line-color : #000088
			line-width : 13:1;16:4;18:6
			line-offset : 13:2;16:9;18:15
			border-width : 0
		if : cycleway left track
			define
				line-offset-sides : left
		if : cycleway right track
			define
				line-offset-sides : right
		draw : line
	
	target : highway*
		define
			line-join : round
			line-start-cap : round
			line-end-cap : round
			

		if : *footway
			define	
				min-zoom : 13
				line-color : #F68474 black 50%
				line-width : 13:1;15:2;18:3
				line-style : dot
				border-style : solid
				border-color : white
				border-width : 100%
				border-opacity : 0.3
				font-size : 15:9;18:12;19:18
			for : bicycle=designated
				define
					line-color : #000088
					line-style : solid
					line-width : 13:1;16:4;18:6
			for : bicycle=yes
				define
					line-color : #000088
					line-style : dash
					line-width : 13:1;16:4;18:6
					border-width : 0
			draw : line
			draw : text		
		elseif : *cycleway
			define	
				min-zoom : 13
				line-color : #000088
				line-width : 13:1;16:4;18:6
				line-style : solid
				border-width : 0
				font-size : 15:9;18:12;19:18
			draw : line
			draw : text
		elseif : *path
			define	
				min-zoom : 13
				line-color : #6E7C6D black 50%
				line-width : 13:1;15:2;18:3
				line-style : dash
				border-style : solid
				border-color : white
				border-width : 100%
				border-opacity : 0.3
				font-size : 15:9;18:12;19:18
			for : bicycle=no OR vehicle=no
				define		
					min-zoom : 13
					line-color : #F68474 black 50%
					line-width : 13:1;15:2;18:3
					line-style : dot
					border-style : solid
					border-color : white
					border-width : 100%
					border-opacity : 0.3		
			for : bicycle=designated
				define
					line-color : #000088
					line-style : solid
					line-width : 13:1;16:4;18:6
					border-width : 0
			for : bicycle=yes
				define
					line-color : #000088
					line-style : dash
					line-width : 13:1;16:4;18:6
					border-width : 0
			draw : line
			draw : text

	target : bicycle_road
		define
			min-zoom : 10
			line-color : #FFFF00
			line-opacity : 0.95
			line-style : solid
			line-width : 10:1;14:5;18:10
		draw : line


	target : highway*
		define
			font-size : 15:9;18:12;19:18
			font-weight : bold
	
		for : oneway=yes OR oneway=true OR oneway=-1
			define 
				min-zoom : 15
				shape : custom
				shape-def : 60,0,20,-50,20,-20,-60,-20,-60,20,20,20,20,50;Z
				shape-size : 20
				shape-aspect : 0.75
				shape-spacing : 6
				fill-color : #6C70D4
				line-style : none
			for : "oneway:bicycle"=no OR cycleway=opposite OR cycleway=opposite_lane OR cycleway=opposite_track
				define
					fill-color : white
					line-style : solid
					line-color : #6C70D4
					line-width : 100%
			for : oneway=-1
				define
					angle : 180
			draw : shape 
		
		define
			line-style : solid
			line-join : round
			line-start-cap : round
			line-end-cap : round

		
		if : *motorway*
			if : *link
				define
					line-width : 7:1;12:3;13:4;16:5;18:6
			else
				define
					line-width : 7:1;9:2;12:3;13:7;16:10;18:12
			define
				min-zoom : 12
				line-color : #849BBD white 50%
				border-style : solid
				border-color : #849BBD black 50%
				border-width : 20%
			draw : line
			define
				min-zoom : 7
				max-zoom : 12
				border-style : none
			draw : line
			define
				min-zoom : 13
				max-zoom : 20
			draw : text
			define
				min-zoom : 10
				max-zoom : 20
				font-family : Tahoma
				text-align-horizontal : center
				text-align-vertical : center
				text : ref
				font-size : 12
				text-color : #fcfcfb
				text-halo-width : 0
				shape : custom
				shape-def : p:#809bc0;pw:5;f:#809bc0;m:-10,-10;l:10,-10;a:10,10,10,10;l:-10,10;a:10,10,-10,-10;z;p:#fcfcfb;pw:2;m:-10,-10;l:10,-10;a:10,10,10,10;l:-10,10;a:10,10,-10,-10;z
				shield-padding-left : 5
				shield-padding-right : 5
				shield-padding-top : 7
				shield-padding-bottom : 7
				shield-resize-mode : free
			draw : shield			
		elseif : *trunk*
			define
				min-zoom : 12
				line-color : #96D296 white 50%
				line-width : 11:1;13:2;15:10;18:12
				border-style : solid
				border-color : #96D296 black 50%
				border-width : 20%
			draw : line
			define
				min-zoom : 7
				max-zoom : 12
				border-style : none
			draw : line
			define
				min-zoom : 13
				max-zoom : 20
			draw : text
		elseif : *primary*
			define
				min-zoom : 11
				line-color : #ECA2A3 white 50%
				line-width : 11:2;12:2;15:10;18:12
				border-style : solid
				border-color : #ECA2A3 black 50%
				border-width : 20%
			draw : line
			define
				min-zoom : 7
				max-zoom : 11
				border-style : none
			draw : line
			define
				min-zoom : 13
				max-zoom : 20
			draw : text
		elseif : *secondary
			define
				min-zoom : 12
				line-color : #FDD6A4 white 50%
				line-width : 10:1;11:2;13:2;15:10;18:12
				border-style : solid
				border-color : #CAA36F black 50%
				border-width : 20%
			draw : line
			define
				min-zoom : 8.5
				max-zoom : 12
				border-style : none
			draw : line
			define
				min-zoom : 13
				max-zoom : 20
			draw : text
		elseif : *tertiary
			define
				min-zoom : 13
				line-color : #FEFEB2 white 50%
				line-width : 10:1;13:2;15:10;18:12
				border-style : solid
				border-color : #FEFEB2 black 50%
				border-width : 20%
			draw : line
			define
				min-zoom : 10
				max-zoom : 13
				line-color : white black 25%
				border-style : none
			draw : line
			define
				min-zoom : 15
				max-zoom : 20
			draw : text
		elseif : *service
			define
				min-zoom : 13
				line-color : white
				line-width : 7:0.6;9:1;10:1.2;12:2.5;13:3;16:5;18:6
				border-style : solid
				border-color : #FEFEB2 black 20%
				border-width : 20%
			draw : line
			define
				min-zoom : 15
				max-zoom : 20
			draw : text
		elseif : *pedestrian
			define
				min-zoom : 13
				line-color : #EDEDED
				line-width : 7:0.6;9:1;10:1.2;12:2.5;13:3;16:5;18:6
				border-style : solid
				border-color : #B1B1B1 black 20%
				border-width : 20%
			draw : line
			define
				min-zoom : 15
				max-zoom : 20
			draw : text
		elseif : $regex("(.*residential)|(.*unclassified)")
			define
				min-zoom : 13
				line-color : white
				line-width : 12:1;13:1.5;15:10;18:12
				border-style : solid
				border-color : white black 75%
				border-width : 20%
			draw : line
			define
				min-zoom : 10
				max-zoom : 13
				border-style : none
				line-color : white black 25%
			draw : line
			define
				min-zoom : 15
				max-zoom : 20
			draw : text
		elseif : *living street
			define
				min-zoom : 13
				line-color : blue white 90%
				line-width : 12:1;13:1.5;15:10;18:12
				border-style : solid
				border-color : white black 50%
				border-width : 20%
			draw : line
			define
				min-zoom : 10
				max-zoom : 13
				border-style : none
				line-color : white black 10%
			draw : line
			define
				min-zoom : 15
				max-zoom : 20
			draw : text

		elseif : *track
			define
				min-zoom : 12.5
				line-color : #9D7517 black 50%
				line-width : 1.5
				line-style : dash
				border-style : solid
				border-color : white
				border-width : 100%
				border-opacity : 0.3
			draw : line
			draw : text
		else
			stop
		
	target : highway steps
		define
			min-zoom : 16
			shape : custom
			shape-def : -1,1, -1,-1, 1,-1, 1,1;Z
			shape-spacing : 2
			shape-size : 16:1;20:3
			shape-aspect : 3
			fill-color : #F98072
			line-style : none
			font-size : 15:9;18:12;19:18
		draw : shape
		draw : text

	target : line barrier
		define
			min-zoom : 13
			line-color : black
			line-width : 1
		draw : line

	target : bridge foot
		define
			min-zoom : 13
			line-color : white
			line-width : 7:0.6;9:1;10:1.2;12:2.5;13:3;16:5;18:6
			border-style : solid
			border-color : #FEFEB2 black 20%
			border-width : 15%
		draw : line
		draw : text

	target : historic citywalls
		define
			min-zoom : 13
			line-color : #8D968D
			line-width : 7:0.6;9:1;10:1.2;12:2.5;13:3;16:10
		draw : line
		draw : text

		define

	target : river
		define
			line-color : #B5D0D0
			line-width : 7:1;12:2;14:5
		draw : line

	target : canal
		define
			min-zoom : 12
			line-color : #B5D0D0
			line-width : 12:1;17:8
		draw : line
		
	target : drain
		define
			min-zoom : 13
			line-color : #B5D0D0
			line-width : 1
		draw : line		
	target : stream
		define
			min-zoom : 13
			line-color : #B5D0D0
			line-width : 13:1;15:2
		draw : line
		
	target: bicycle parking
		define
			icon-image : icons/SJJB/png/transport_parking_bicycle.n.32.png
			text-offset-horizontal : 60%
			text-offset-vertical : -75%
			text : capacity
			min-zoom : 15
			icon-width : 16
		draw : text
		draw : icon

	target: mini roundabout
		define
			icon-image : icons/SJJB/png/transport_roundabout_anticlockwise.p.32.png
			min-zoom : 16
			icon-width : 9
		draw : icon

	target : puffin
		define
			icon-image : icons/SJJB/png/transport_traffic_lights.p.32.png
			min-zoom : 16
			icon-width : 16
		draw : icon

	target : gate
		define
			icon-image : http://svn.openstreetmap.org/applications/rendering/mapnik/symbols/gate2.png
			min-zoom : 16
			icon-width : 7
		draw : icon

	target : bollard
		define
			icon-image : http://svn.openstreetmap.org/applications/rendering/mapnik/symbols/bollard.png
			min-zoom : 16
			icon-width : 7
		draw : icon

	target: coastline
		define
			line-color : #B5D0D0
			line-width : 2
		draw : line