[Potlatch-dev] Stylesheets (Potlatch 2/Halcyon)

Matt Amos zerebubuth at gmail.com
Tue Jul 14 13:53:35 BST 2009


On Tue, Jul 14, 2009 at 1:19 PM, Richard Fairhurst<richard at systemed.net> wrote:
> Hi all,
>
> Halcyon is the new WYSIWYG rendering engine for Potlatch 2. It draws
> ways and nodes according to rules in a stylesheet. You can see a demo
> at http://www.geowiki.com/halcyon/ .
>
> At present the stylesheet is a big YAML file, simply because it's very
> easy to parse. You can see one at
> http://svn.openstreetmap.org/applications/editors/potlatch2/test.yaml .
>
> But it's rather ugly, verbose, and not widely understood, so I'd like
> to move to something more CSS-like. Good work has already been done
> here by Cascadenik and Cartagen.
>
> My current thinking is that such a stylesheet might look roughly like this:
>
>     // One simple rule
>     highway=primary {
>       color: red;
>       width: 5px;
>       border: 2px solid black;
>     }
>
>     // More complex rule
>     highway=trunk && oneway=yes {
>       color: green;
>       width: 4px;
>       border: 2px solid black;
>     }
>
>     // Two rules, same style for both
>     highway=unclassified, highway=tertiary {
>       color: yellow;
>       width: 4px;
>       border: 2px solid black;
>     }
>
>     // Specifying zoom level
>     [z13-15] highway=residential {
>       color: #777777;
>       width: 3px;
>       border: 1px solid black;
>     }
>
> In other words, the 'selector' is the tag rule. (There might be some
> special selectors, too: one for the background and one for a default
> style if nothing matches.)

also maybe:

// specifying the existence (or not) of a tag
amenity=place_of_worship && not_exists(religion) {
  // generic place_of_worship symbol
}

// relationships between elements
member_of(type=restriction, role=via) {
  // draw some overlay for turn restriction "via" nodes
}

it could get arbitrarily complex, i guess:

// shared nodes
count(parent(way)) > 1 && type=node {
  // ...
}

> Does this make sense as a general approach?

yup. but i guess there's a decision to be made about whether a
fully-general approach works well, or if there's still some things
which are too complex to be done in the style sheet...

cheers,

matt




More information about the Potlatch-dev mailing list