Hi Peter,

On Thu, Aug 4, 2011 at 8:08 AM, Peter Körner <[email protected]>wrote:

>
> The question is: how to do this nicely - pass Parameters from Python to the
> Stylesheet.
>
> Two obvious solutions would be
>  - preprocess the style with "xmllint --noent", collect the xml into a
> string and replace some placeholder, eg. {DATE} with the requested
> timestamp, then use mapnik.load_map_from_string. This requires the
> libxml2-utils to be installed.
>
>  - preprocess the style with the python sax-parser and replace the
> placeholder on the go, assemble everything on the go and feed mapnik with
> it.
>
> The question is: is there a nicer way to go?
>

You can do a load_map and then explicitly update filters from defaults to
non-defaults, although if you change the XML file it won't magically start
replacing - not DRY. What I've done before is load an XML file with no
filters attached to the rules (but all the styles) and add the filters using
the Python API.

Rob :)

-- 
Koordinates Ltd.
PO Box 1604, Shortland St, Auckland 1140, New Zealand
Phone +64-9-966 0433 Fax +64-9-969 0045
Web http://koordinates.com/
_______________________________________________
Mapnik-users mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/mapnik-users

Reply via email to