Skip to content
This repository has been archived by the owner on Aug 22, 2023. It is now read-only.

Commit

Permalink
GDAL: forcing float data type for DEM warp
Browse files Browse the repository at this point in the history
  • Loading branch information
vaclavblazek committed Sep 14, 2020
1 parent 9fd56e4 commit 9ce3ead
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
8 changes: 7 additions & 1 deletion mapproxy/src/mapproxy/gdalsupport/operations.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 << ".";

Expand Down

0 comments on commit 9ce3ead

Please sign in to comment.