[OSM-talk] simplifying mapnik layout definition

Dave Stubbs osm.list at randomjunk.co.uk
Tue May 27 16:37:21 BST 2008


On Tue, May 27, 2008 at 3:40 PM, Andreas Barth <aba at not.so.argh.org> wrote:
> Hi,
>
> currently the mapnik layout definition is a bit complex. Please consider
> this example:
> <Style name="tunnels-casing">
>    <Rule>
>      <Filter>([highway] = 'motorway' or [highway]='motorway_link') and ([tunnel] = 'yes' or [tunnel] ='true')</Filter>
>      <MaxScaleDenominator>200000</MaxScaleDenominator>
>      <MinScaleDenominator>100000</MinScaleDenominator>
>      <LineSymbolizer>
>        <CssParameter name="stroke">#506077</CssParameter>
>        <CssParameter name="stroke-width">3</CssParameter>
>        <CssParameter name="stroke-dasharray">4,2</CssParameter>
>      </LineSymbolizer>
>    </Rule>
>    <Rule>
>      <Filter>([highway] = 'motorway' or [highway]='motorway_link') and ([tunnel] = 'yes' or [tunnel] ='true')</Filter>
>      <MaxScaleDenominator>100000</MaxScaleDenominator>
>      <MinScaleDenominator>20000</MinScaleDenominator>
>      <LineSymbolizer>
>        <CssParameter name="stroke">#506077</CssParameter>
>        <CssParameter name="stroke-width">5.5</CssParameter>
>        <CssParameter name="stroke-dasharray">4,2</CssParameter>
>      </LineSymbolizer>
>    </Rule>
> [ 2 more cases ]
>
>
> The differences are only within the scales. So it would make sense to
> split the scales off - and make them as small as possible. The smaller
> it is, the easier one can make changes. So this could be written as:
>
> <Style name="tunnels-casing">
>      <Rules filter="([highway] = 'motorway' or [highway]='motorway_link') and ([tunnel] = 'yes' or [tunnel] ='true')"/>
>      <CssParameter name="stroke">#506077</CssParameter>
>      <CssParameter name="stroke-dasharray">4,2</CssParameter>
>      <ScaleDenominator max="200000" min="100000">
>        <CssParameter name="stroke-width">3</CssParameter>
>      </ScaleDenominator>
>      <ScaleDenominator max="100000" min="20000">
>        <CssParameter name="stroke-width">5.5</CssParameter>
>      </ScaleDenominator>
>    </Rules>
>
>
> This drops the (IMHO unnecessary) LineSymbolizer (one can make it up
> from the stuff around it) and emphasizes the differences. If this looks
> ok-ish, I could write an converter from the new to the old format as an
> starter.


I don't think inferring the LineSymbolizer is a good idea. But if you
want to write a preprocessor to do the scale extraction I think that
might help a lot.
Personally I'd like to see an end to the XML syntax as it's hard to
read, but that's more work than it's worth right now (to me at least).

Dave




More information about the talk mailing list