From cdcc97ac4b631b9ec8dabb399998581c022071ab Mon Sep 17 00:00:00 2001 From: Tim Gleason Date: Sun, 5 May 2019 12:02:47 -0400 Subject: [PATCH] Add command line options for map size to mapnik-render. --- utils/mapnik-render/mapnik-render.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/utils/mapnik-render/mapnik-render.cpp b/utils/mapnik-render/mapnik-render.cpp index c172995c7..299ce7ffb 100644 --- a/utils/mapnik-render/mapnik-render.cpp +++ b/utils/mapnik-render/mapnik-render.cpp @@ -29,6 +29,8 @@ int main (int argc,char** argv) bool params_as_variables = false; mapnik::logger logger; logger.set_severity(mapnik::logger::error); + int map_width = 600; + int map_height = 400; try { @@ -41,6 +43,8 @@ int main (int argc,char** argv) ("xml",po::value(),"xml map to read") ("img",po::value(),"image to render") ("scale-factor",po::value(),"scale factor for rendering") + ("map-width",po::value(),"map width in pixels") + ("map-height",po::value(),"map height in pixels") ("variables","make map parameters available as render-time variables") ; @@ -103,9 +107,17 @@ int main (int argc,char** argv) params_as_variables = true; } + if (vm.count("map-width")) { + map_width = vm["map-width"].as(); + } + + if (vm.count("map-height")) { + map_height = vm["map-height"].as(); + } + mapnik::datasource_cache::instance().register_datasources("./plugins/input/"); mapnik::freetype_engine::register_fonts("./fonts",true); - mapnik::Map map(600,400); + mapnik::Map map(map_width,map_height); mapnik::load_map(map,xml_file,true); map.zoom_all(); mapnik::image_rgba8 im(map.width(),map.height());