Published by breki on 18 Feb 2010 at 08:49 pm
Maperitive Rendering Rules: Sneak Preview
Since rendering rules parsing and processing has more or less been implemented a few weeks ago, I think it’s time to show how these rules look like.
I’ve tried to mimic some of the styles and colors used for Mapnik OSM map (although this covers only about 10% of Mapnik’s rules). I won’t be explaining these rules right now because I’m interested in what you think of them at the first glance – can you understand the basic concept or not? Are the rules too verbose? Are they legible? The only hint I will give is: indentation is important!
So here it is, the first part (I have to split this into two posts, WordPress problems) :
features
parking : amenity=parking
contours major : contour[elevation=50]
contours minor : contour[elevation=10]
areas
forest : landuse=forest OR natural=wood
farm : landuse=farm
fell : natural=fell
national park : boundary=national_park
water : natural=water OR waterway=riverbank
residential area : landuse=residential
lines
river : waterway=river
railway : railway=rail
road motorway : highway=motorway
road motorway link : highway=motorway_link
road trunk : highway=trunk
road primary : highway=primary
road secondary : highway=secondary
road tertiary : highway=tertiary
road unclassified : highway=unclassified
road residential : highway=residential
road track : highway=track
road footway : highway=footway
state borders : relation[boundary=administrative AND admin_level=4]
properties
map-background-color : #F1EEE8
map-background-opacity : 1
rules
rulefor : areas
define
line-style : none
for : forest
define
min-zoom : 9
fill-color : #8DC56C
elsefor : farm
define
fill-color : #E9D8BD
elsefor : fell
define
fill-color : #C5FF5B black 10%
elsefor : water
define
fill-color : #B5D0D0
elsefor : residential
define
fill-color : #DCDCDC
else
stop
draw : fill


igorbrejc.net » Maperitive Rendering Rules, Sneak Preview (Part 2) on 18 Feb 2010 at 21:10 #
[...] Maperitive Rendering Rules, Sneak Preview (Part 2) [...]
Thomas on 21 Feb 2010 at 17:38 #
Hi, i try to understand, how to use various renderingrules. But the usermanual is not very helpfull. At first i found errors: for exampel : “nocpgs Option”. I think it means “nocgp Option”. Another confus information: under “ibf2osm” command is explained the “gridlat” and “gridlon” option. But this option works with the “contours” command and should placed under “contours-command. Many rules from the wiki-page crashes groundtruth1-8-740.exe. For exampel :Scanning map data… Fetching contours rendering rules from ‘http://wiki.openstreetmap.org/wiki/User: Breki/GroundTruth_Contour_Rules’… ERROR: System.ArgumentException: Both line widths and the line pattern are speci fied. These are mutually exclusive – choose one or the other (line 38) at GroundTruth.Engine.WikiRulesParserBase.ThrowParseError(String errorMessage Format, Object[] args).
So i decide to write my own rules. But where can i find a manual for writing rules ?. Which syntax to use?. which char is for comment ?. I have copied the sourcecode from the wiki-rules-website and saved localy as Rules.txt. Sometimes it works. Exampel : {{GroundTruthRenderingRules | description=for hiking maps | version=1.6 | changepolicy=Feel free to modify or add new rules to this page if you find stuff that’s relevant to hiking.}}
== Rendering Rules ==
=== Options === {| class=”wikitable” border=”1″ cellspacing=”0″ cellpadding=”2″ |- style=”background-color:#F8F4C2″ ! Option ! Value ! Comment |-
=== Areas === {| class=”wikitable” border=”1″ cellspacing=”0″ cellpadding=”0″ |- style=”background-color:#F8F4C2″ ! style=”width:100px” | Rule Name ! style=”width:200px” | Selector ! style=”width:20px” | Min Level ! style=”width:20px” | Max Level ! style=”width:200px” | Type Name ! style=”width:100px” | Label there are mysterious chars in it. I can not found any system in the syntax. Please give me any help for the right syntax or a link for helppage. osm- Tag’s are not a problem, but the right syntax for creating a rule as txt-file. At this time it is not possibly to use any SRTM-files from a local-drive. Alltimes the application loads the srtm from internet. In my opinon it is a goot idee for the next release to use both sources : internet and local-hdd. Most srtm are already exists on my computer .Also the 1″ srtm from Jonas DeFerantie. answers to webmaster@img2ms.de are welcome.
thanks