From 9ce3ead72924591ab87b84f0bdc00822ee7d73ca Mon Sep 17 00:00:00 2001 From: Vaclav Blazek Date: Mon, 14 Sep 2020 18:23:27 +0200 Subject: [PATCH] GDAL: forcing float data type for DEM warp --- externals/libgeo | 2 +- externals/libutility | 2 +- mapproxy/src/mapproxy/gdalsupport/operations.cpp | 8 +++++++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/externals/libgeo b/externals/libgeo index 6aafeac..cf1929f 160000 --- a/externals/libgeo +++ b/externals/libgeo @@ -1 +1 @@ -Subproject commit 6aafeac8dcb80d0205d0f4131d6d8a3cd83458f6 +Subproject commit cf1929f9a1502a84a599eeb4bd61b52360730229 diff --git a/externals/libutility b/externals/libutility index 40a65eb..dfb9318 160000 --- a/externals/libutility +++ b/externals/libutility @@ -1 +1 @@ -Subproject commit 40a65eb301cd23ee00ca9f61a8c0d4599bc7477a +Subproject commit dfb931846039b6747bbbb0138acfb678c9b6bd63 diff --git a/mapproxy/src/mapproxy/gdalsupport/operations.cpp b/mapproxy/src/mapproxy/gdalsupport/operations.cpp index 015862e..1f033d9 100644 --- a/mapproxy/src/mapproxy/gdalsupport/operations.cpp +++ b/mapproxy/src/mapproxy/gdalsupport/operations.cpp @@ -96,6 +96,7 @@ cv::Mat* warpImage(DatasetCache &cache, ManagedBuffer &mb auto &src(cache(dataset)); auto dst(geo::GeoDataset::deriveInMemory (src, srs, size, extents, boost::none, asOptNodata(nodata))); + src.warpInto(dst, resampling); if (optimize && dst.cmask().empty()) { @@ -135,6 +136,7 @@ cv::Mat* warpMask(DatasetCache &cache, ManagedBuffer &mb auto &src(cache(dataset)); auto dst(geo::GeoDataset::deriveInMemory (src, srs, size, extents, boost::none, asOptNodata(nodata))); + src.warpInto(dst, resampling); // fetch mask from dataset (optimized, all valid -> invalid matrix) @@ -213,6 +215,7 @@ cv::Mat* warpValueMinMax(DatasetCache &cache, ManagedBuffer &mb // choose finer overview on GDAL>=2.2, since there is something rotten there warpOptions.overviewBias = -1; #endif + warpOptions.workingDataType = GDT_Float32; auto wri(src.warpInto(dst, resampling, warpOptions)); minSrc.warpInto(minDst, geo::GeoDataset::Resampling::minimum @@ -300,7 +303,10 @@ cv::Mat* warpDem(DatasetCache &cache, ManagedBuffer &mb (src, srs, gridSize, gridExtents, ::GDT_Float32 , asOptNodata(nodata, ForcedNodata))); - auto wri(src.warpInto(dst, geo::GeoDataset::Resampling::dem)); + geo::GeoDataset::WarpOptions wo; + wo.workingDataType = ::GDT_Float32; + + auto wri(src.warpInto(dst, geo::GeoDataset::Resampling::dem, wo)); LOG(info1) << "Warp result: scale=" << wri.scale << ", resampling=" << wri.resampling << ".";