diff --git a/include/mapnik/svg/svg_parser.hpp b/include/mapnik/svg/svg_parser.hpp index db0e2fe9c..b3e118984 100644 --- a/include/mapnik/svg/svg_parser.hpp +++ b/include/mapnik/svg/svg_parser.hpp @@ -106,6 +106,7 @@ class MAPNIK_DECL svg_parser : private util::noncopyable bool strict_; bool ignore_; bool css_style_; + bool dimensions_ = false; std::map gradient_map_; std::map const*> node_cache_; mapnik::css_data css_data_; diff --git a/src/svg/svg_parser.cpp b/src/svg/svg_parser.cpp index 829dd326c..fb7efa285 100644 --- a/src/svg/svg_parser.cpp +++ b/src/svg/svg_parser.cpp @@ -1000,7 +1000,11 @@ void parse_dimensions(svg_parser& parser, rapidxml::xml_node const* node) parser.path_.set_dimensions(0, 0); return; } - parser.path_.set_dimensions(width, height); + if (!parser.dimensions_) + { + parser.dimensions_ = true; + parser.path_.set_dimensions(width, height); + } } void parse_path(svg_parser& parser, rapidxml::xml_node const* node)