#include #include #include #include #include #include namespace bg = boost::geometry; typedef bg::model::d2::point_xy point_type; typedef bg::model::polygon polygon_type; typedef bg::model::multi_polygon multipolygon_type; int main() { // Specify the basic type typedef boost::geometry::model::d2::point_xy point_type; multipolygon_type mpoly; boost::geometry::read_wkt("MULTIPOLYGON(((1371 932,1371 789,3171 789,3171 2589,3156 1669,3156 1650,2262 1200,1371 932)),((1371 1672,2262 2160,1341 2589,1371 2589,1371 1672)))", mpoly); std::cout << "is valid? " << bg::is_valid(mpoly) << std::endl; // Declare a stream and an SVG mapper std::ofstream svg("my_map.svg"); boost::geometry::svg_mapper mapper(svg, 400, 400); // Add geometries such that all these geometries fit on the map mapper.add(mpoly); // Draw the geometries on the SVG map, using a specific SVG style mapper.map(mpoly, "fill-opacity:0.3;fill:rgb(51,51,153);stroke:rgb(51,51,153);stroke-width:2"); // Destructor of map will be called - adding // Destructor of stream will be called, closing the file return 0; }