+ figure out raster format from file name unless explicitely specified by

'format' parameter.
This commit is contained in:
artemp 2013-04-10 12:16:19 +01:00
parent 06e629112d
commit 48fa520a83

View file

@ -27,6 +27,7 @@
// mapnik
#include <mapnik/debug.hpp>
#include <mapnik/ctrans.hpp>
#include <mapnik/image_util.hpp>
#include <mapnik/image_reader.hpp>
#include <mapnik/boolean.hpp>
@ -46,9 +47,9 @@ using mapnik::image_reader;
DATASOURCE_PLUGIN(raster_datasource)
raster_datasource::raster_datasource(parameters const& params)
: datasource(params),
desc_(*params.get<std::string>("type"), "utf-8"),
extent_initialized_(false)
: datasource(params),
desc_(*params.get<std::string>("type"), "utf-8"),
extent_initialized_(false)
{
MAPNIK_LOG_DEBUG(raster) << "raster_datasource: Initializing...";
@ -65,7 +66,8 @@ raster_datasource::raster_datasource(parameters const& params)
tile_size_ = *params.get<int>("tile_size", 256);
tile_stride_ = *params.get<int>("tile_stride", 1);
format_ = *params.get<std::string>("format","tiff");
boost::optional<std::string> format_from_filename = mapnik::type_from_filename(*file);
format_ = *params.get<std::string>("format",format_from_filename?(*format_from_filename) : "tiff");
boost::optional<double> lox = params.get<double>("lox");
boost::optional<double> loy = params.get<double>("loy");