[OSM-talk] RFC: Tagging and rendering Australian highway numbers

Andy Allan gravitystorm at gmail.com
Wed Jul 25 14:16:05 BST 2007


On 7/25/07, Cameron Patrick <cameron at patrick.wattle.id.au> wrote:
> G'day again,
>
> Along with the experimenting with Mapnik I've been doing, I've also been
> trying to add the correct symbols for Australian highway numbers.
> Unfortunately, it's a bit of a mess because there are several different
> types of them, each with different colours and their own 'shield'
> symbols.
>
> But first, the cool stuff - here's a map of Perth with ref= rendered
> using the right symbols:
>
>         http://largestprime.net/cameron/osm-tmp/perth-z12.jpg
>
> You can see the blue-and-white state routes and green-and-yellow
> national routes (Great Eastern and Great Northern highways here).  The
> icons come from Wikimedia Commons and are public domain.  The downside
> is that I'm using a different image for each route number, which doesn't
> scale particularly well, because it entails a new mapnik rule for each.

You should use the ShieldSymbolizer to write numbers over the top of a
generic shield. See how it's done for highway=motorway in
http://svn.openstreetmap.org/applications/rendering/mapnik/osm.xml .
Note that the length is the number of characters in the reference -
each shield png is slightly different width to accomodate it. Look for
"char_length(ref) as length" at the bottom of the file.

I would suggest if you need to cope with multiple refs you
disambiguate them in the key, not the value, as it makes it much
easier to select the different keys and deal with the separately. If
you have e.g. ref="National M1" you'll end up have to parse the value
to work out how you want to draw it, and again to know which bit is
the reference and which bit is just metadata.

Cheers,
Andy




More information about the talk mailing list