From efc65126db5d51977d6374f9b983fc441f334eb6 Mon Sep 17 00:00:00 2001 From: Christoph Paulik Date: Tue, 11 Feb 2020 12:33:10 +0100 Subject: [PATCH] Add Int32 support for gdal driver --- plugins/input/gdal/gdal_featureset.cpp | 19 +++++++++++++++++++ test/data | 2 +- test/data-visual | 2 +- 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/plugins/input/gdal/gdal_featureset.cpp b/plugins/input/gdal/gdal_featureset.cpp index 5503a5a69..47dfdf4cb 100644 --- a/plugins/input/gdal/gdal_featureset.cpp +++ b/plugins/input/gdal/gdal_featureset.cpp @@ -399,6 +399,25 @@ feature_ptr gdal_featureset::get_feature(mapnik::query const& q) feature->set_raster(raster); break; } + case GDT_Int32: + { + mapnik::image_gray32s image(im_width, im_height); + image.set(std::numeric_limits::max()); + raster_nodata = band->GetNoDataValue(&raster_has_nodata); + raster_io_error = band->RasterIO(GF_Read, x_off, y_off, width, height, + image.data(), image.width(), image.height(), + GDT_Int32, 0, 0); + if (raster_io_error == CE_Failure) + { + throw datasource_exception(CPLGetLastErrorMsg()); + } + mapnik::raster_ptr raster = std::make_shared(feature_raster_extent, intersect, image, filter_factor); + // set nodata value to be used in raster colorizer + if (nodata_value_) raster->set_nodata(*nodata_value_); + else raster->set_nodata(raster_nodata); + feature->set_raster(raster); + break; + } default: case GDT_Int16: { diff --git a/test/data b/test/data index b4aa4c462..6636c0455 160000 --- a/test/data +++ b/test/data @@ -1 +1 @@ -Subproject commit b4aa4c462fd827c388805ddeb5a163edefd62c7e +Subproject commit 6636c04550c489db52180c47325513cf9bc09d6d diff --git a/test/data-visual b/test/data-visual index 6a1af6c24..629fefc69 160000 --- a/test/data-visual +++ b/test/data-visual @@ -1 +1 @@ -Subproject commit 6a1af6c24b2f5b15f1165b33efb4ce339c955a4c +Subproject commit 629fefc6994033085e55d8532e0a7b4b45227290