From e6e32fcb39202081115f490dbacd5a1b4ca04d61 Mon Sep 17 00:00:00 2001 From: artemp Date: Thu, 16 Aug 2012 11:00:07 +0100 Subject: [PATCH] + applied patch from @lightmare - #1325 --- bindings/python/python_grid_utils.cpp | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/bindings/python/python_grid_utils.cpp b/bindings/python/python_grid_utils.cpp index f0b99f714..ab4a90b49 100644 --- a/bindings/python/python_grid_utils.cpp +++ b/bindings/python/python_grid_utils.cpp @@ -379,12 +379,15 @@ void render_layer_for_grid(const mapnik::Map& map, throw std::runtime_error(s.str()); } - // convert python list to std::vector + // convert python list to std::set + std::set attributes; boost::python::ssize_t num_fields = boost::python::len(fields); for(boost::python::ssize_t i=0; i name(fields[i]); - if (name.check()) { + if (name.check()) + { grid.add_property_name(name()); + attributes.insert(name()); } else { @@ -394,8 +397,6 @@ void render_layer_for_grid(const mapnik::Map& map, } } - // copy property names - std::set attributes = grid.property_names(); std::string const& key = grid.get_key(); // if key is special __id__ keyword @@ -405,13 +406,10 @@ void render_layer_for_grid(const mapnik::Map& map, // if __id__ is requested to be dumped out // remove it so that datasource queries will not break - if (attributes.find(key) != attributes.end()) - { - attributes.erase(key); - } + attributes.erase(key); } // if key is not the special __id__ keyword - else if (attributes.find(key) == attributes.end()) + else { // them make sure the datasource query includes this field attributes.insert(key);