Hi Graham, 
>What I would like to do is combine the two - have the main map definition in 
>an XML file, but then tweak it using python before rendering (ie switching 
>layers on and off, changing datasources >etc.).
>If anyone could confirm if this is supposed to be possible it would be 
>appreciated, as would any pointers to examples or documentation?
Very interesting.I've managed to do something like that, layer definitions in 
XML and some styles in python, look at the example:Bye.

import mapnik
mapfile='map_definitions.xml'm = mapnik.Map(5600, 2400)mapnik.load_map(m, 
mapfile)lay=m.layers[0] #this is a layer that was created in XMLs = 
mapnik.Style()r=mapnik.Rule()
t = mapnik.TextSymbolizer('name', 'DejaVu Sans Book', 10, 
mapnik.Color('black'))t.allow_overlap=1t.label_placement=mapnik.label_placement.line
r.symbols.append(t)s.rules.append(r)m.append_style('My 
Style',s)lay.styles.append('My Style')bbox = 
mapnik.Envelope(228723,7485713,230810,7484489)m.zoom_to_box(bbox)mapnik.render_to_file(m,
 'temp_teste.jpg','jpeg')
                                          
_______________________________________________
Mapnik-users mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/mapnik-users

Reply via email to