mapnik-org/mapnik — Issue #783: Mapnik's XML styles are requiring much more redundancy than needed
Author: artemp
Created: 2011-10-11 08:12:02+00:00
State: open
Labels: XML

Mapnik's XML structure is quite unflexible, which causes enforced introduction of redundancy into style. I will explain my ideas on following examples:

== Example 1 ==
User must write separate rule for every zoom level, if he wants to change just one parameter:

{{{

(([highway]='tertiary') and not (([tunnel]='yes')))
&minscale_zoom13;
&maxscale_zoom13;

rgb(204,204,204)
4.5
round
round

(([highway]='tertiary') and not (([tunnel]='yes')))
&minscale_zoom14;
&maxscale_zoom14;

rgb(204,204,204)
6
round
round

}}}

This two rules has much information redundant - filter, stroke, stroke-linejoin, stroke-linecap. However this rules could have been written in much simpler form like this:

{{{

(([highway]='tertiary') and not (([tunnel]='yes')))
&minscale_zoom14;
&maxscale_zoom13;

rgb(204,204,204)
4.5
6
round
round

}}}

== Example 2 ==
It is not possible to write filters, that just slightly modify rule:

{{{

([ncn]!='' and [state]='proposed')
&maxscale_zoom13;

&color_ncn;
0.3
12
round
round
1, 20

([ncn]!='' and [state]!='proposed')
&maxscale_zoom13;

&color_ncn;
0.3
12
round
round

}}}

Could have been rewritten to something like this:

{{{

([ncn]!='' and [state]='proposed')
&maxscale_zoom13;

&color_ncn;
0.3
12
round
round

1, 20

}}}