Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

python: Style().image_filters = 'x' appends instead of setting new value #1534

Closed
lightmare opened this Issue · 0 comments

2 participants

@lightmare

buggy:

>>> import mapnik
>>> s = mapnik.Style()
>>> s.image_filters
''
>>> s.image_filters = 'gray'
>>> s.image_filters
'gray'
>>> s.image_filters = 'sharpen'
>>> s.image_filters
'gray sharpen'

patch:

diff --git a/bindings/python/mapnik_style.cpp b/bindings/python/mapnik_style.cpp
index ff41c84..bf50cc0 100644
--- a/bindings/python/mapnik_style.cpp
+++ b/bindings/python/mapnik_style.cpp
@@ -49,14 +49,18 @@ void set_image_filters(feature_type_style & style, std::string const& filters)
     std::string::const_iterator end = filters.end();
     mapnik::image_filter_grammar<std::string::const_iterator,
                                  std::vector<mapnik::filter::filter_type> > filter_grammar;
+    std::vector<mapnik::filter::filter_type> new_filters;
+
     bool result = boost::spirit::qi::phrase_parse(itr,end,
                                                   filter_grammar,
                                                   boost::spirit::qi::ascii::space,
-                                                  style.image_filters());
+                                                  new_filters);
     if (!result || itr!=end)
     {
         throw mapnik::value_error("failed to parse image-filters: '" + std::string(itr,end) + "'");
     }
+
+    style.image_filters().swap(new_filters);
 }

 void export_style()
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.