Ticket #99 (new enhancement)
Ability to load mapnik xml from string
| Reported by: | springmeyer | Owned by: | artem |
|---|---|---|---|
| Milestone: | 1.0.0 | Component: | Boost.Python Binding |
| Version: | SVN Trunk | Severity: | Enhancement |
| Keywords: | xml from string, mapfile | Cc: | dane.springmeyer@… |
Description
It could be useful to be able to store a mapnik xml mapfile within a python script and (after potentially manipulating the xml in memory) then load the configuration.
There could be a mapnik.map_from_string() function or mapnik.load_map() could accept xml string so that you could say:
mapfile = '''<Map bgcolor="steelblue" srs="+proj=latlong +datum=WGS84">
<Style name="My Style">
<Rule>
<PolygonSymbolizer>
<CssParameter name="fill">#f2eff9</CssParameter>
</PolygonSymbolizer>
<LineSymbolizer>
<CssParameter name="stroke">rgb(50%,50%,50%)</CssParameter>
<CssParameter name="stroke-width">0.1</CssParameter>
</LineSymbolizer>
</Rule>
</Style>
<Layer name="world">
<StyleName>My Style</StyleName>
<Datasource>
<Parameter name="type">shape</Parameter>
<Parameter name="file">../data/world_borders</Parameter>
</Datasource>
</Layer>
</Map>'''
from mapnik import *
m = Map(600, 300)
load_map(m, mapfile)
[...]
Change History
Note: See
TracTickets for help on using
tickets.
