Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Complete XML serialization in save_map #1562

Closed
yvecai opened this Issue · 1 comment

2 participants

yvecai Dane Springmeyer
yvecai

In python, save_map() does not output LineSymbolizer().offset.

Would be great if we could build xml strings for any map elements (styles, rules, symbolizer, ...).

import os, sys
from mapnik import *
proj = "+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs +over"
map=Map(100,100,proj)
map.background = Color("transparent")

s = (Style())
r= Rule()
width = 5
line = LineSymbolizer(Color('white'),5)
line.offset = 12
r.symbols.append(line)
s.rules.append(r)
map.append_style('my style',s)

print save_map_to_string(map)
<?xml version="1.0" encoding="utf-8"?>
<Map srs="+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs +over" background-color="rgba(0,0,0,0)">
    <Style name="my style">
        <Rule>
            <LineSymbolizer stroke="rgb(255,255,255)" stroke-width="5"/>
        </Rule>
    </Style>
</Map>
Dane Springmeyer
Owner

awesome catch, thank you. Also backported to 2.1.x in 13a4372

PetrDlouhy PetrDlouhy referenced this issue from a commit in PetrDlouhy/mapnik
Dane Springmeyer springmeyer add #1562 to master changelog 6e7eddb
PetrDlouhy PetrDlouhy referenced this issue from a commit in PetrDlouhy/mapnik
Dane Springmeyer springmeyer fix method name - refs #1562 b91dcb7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.