diff --git a/plugins/input/raster/raster_datasource.cpp b/plugins/input/raster/raster_datasource.cpp index 110211251..25541857d 100644 --- a/plugins/input/raster/raster_datasource.cpp +++ b/plugins/input/raster/raster_datasource.cpp @@ -27,6 +27,7 @@ // mapnik #include #include +#include #include #include @@ -46,9 +47,9 @@ using mapnik::image_reader; DATASOURCE_PLUGIN(raster_datasource) raster_datasource::raster_datasource(parameters const& params) - : datasource(params), - desc_(*params.get("type"), "utf-8"), - extent_initialized_(false) +: datasource(params), + desc_(*params.get("type"), "utf-8"), + extent_initialized_(false) { MAPNIK_LOG_DEBUG(raster) << "raster_datasource: Initializing..."; @@ -65,15 +66,16 @@ raster_datasource::raster_datasource(parameters const& params) tile_size_ = *params.get("tile_size", 256); tile_stride_ = *params.get("tile_stride", 1); - format_ = *params.get("format","tiff"); + boost::optional format_from_filename = mapnik::type_from_filename(*file); + format_ = *params.get("format",format_from_filename?(*format_from_filename) : "tiff"); boost::optional lox = params.get("lox"); boost::optional loy = params.get("loy"); boost::optional hix = params.get("hix"); boost::optional hiy = params.get("hiy"); - + boost::optional ext = params.get("extent"); - + if (lox && loy && hix && hiy) { extent_.init(*lox, *loy, *hix, *hiy); @@ -88,7 +90,7 @@ raster_datasource::raster_datasource(parameters const& params) { throw datasource_exception("Raster Plugin: valid or are required"); } - + if (multi_tiles_) { boost::optional x_width = params.get("x_width");