diff --git a/include/mapnik/hextree.hpp b/include/mapnik/hextree.hpp index 042c6b9df..9703e8eb9 100644 --- a/include/mapnik/hextree.hpp +++ b/include/mapnik/hextree.hpp @@ -263,8 +263,10 @@ public: { byte a = preprocessAlpha(c.a); unsigned ind=0; - if (a < InsertPolicy::MIN_ALPHA || colors_ <= 1) + if (a < InsertPolicy::MIN_ALPHA || colors_ == 0) return 0; + if (colors_ == 1) + return pal_remap_[has_hole_?1:0]; rgba_hash_table::iterator it = color_hashmap_.find(c); if (it == color_hashmap_.end()) @@ -472,7 +474,7 @@ private: } tries=0; // ignore leaves and also nodes with small mean error and not excessive number of pixels - if (cur_node->reduce_cost / cur_node->pixel_count * std::log(long(cur_node->pixel_count)) > 20 + if ((cur_node->reduce_cost / cur_node->pixel_count + 1) * std::log(long(cur_node->pixel_count)) > 15 && cur_node->children_count > 0) { colors_--;