Skip to content

Instantly share code, notes, and snippets.

@springmeyer
Created June 18, 2012 19:19
Show Gist options
  • Save springmeyer/2950177 to your computer and use it in GitHub Desktop.
Save springmeyer/2950177 to your computer and use it in GitHub Desktop.
test mapnik dash-array parser in XML
import mapnik
map_string = """
<Map>
<Style name="test">
<Rule>
<LineSymbolizer stroke-dasharray="22.5,0" />
</Rule>
</Style>
</Map>
"""
m = mapnik.Map(256,256)
mapnik.load_map_from_string(m,map_string)
s = m.find_style('test')
s.rules[0].symbols[0].stroke.get_dashes()
@springmeyer
Copy link
Author

>>> import mapnik
>>> 
>>> map_string = """
... <Map>
... <Style name="test">
... <Rule>
... <LineSymbolizer stroke-dasharray="22.5,0" />
... </Rule>
... </Style>
... </Map>
... """
>>> 
>>> m = mapnik.Map(256,256)
>>> 
>>> mapnik.load_map_from_string(m,map_string)
>>> s = m.find_style('test')
>>> s.rules[0].symbols[0].stroke.get_dashes()
[(22.5, 0.0)]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment