DEM.Net icon indicating copy to clipboard operation
DEM.Net copied to clipboard

GetVirtualHeightMapInBBox does not work when DEMFileRegistrationMode is Cell

Open g0ro opened this issue 3 years ago • 1 comments

Trying to get heightmap in bbox, using GeoTiff dataset with Cell file format, fails when bbox is partially covered.

RasterService.GetVirtualHeightMapInBBox(...) returns a hightmap half pixel shifted. This results in incorrect height map when merging tilesHeightMap in ElevationService.GetHeightMap(....)

When DEMFileRegistrationMode is Cell, we should add (metadata.pixelSizeY / 2d) to metadata.DataEndLat, and (metadata.pixelSizeX / 2d) to metadata.DataStartLon (File: https://github.com/dem-net/DEM.Net/blob/168cd8e0e277793227f9cacd1cd26310ba495928/DEM.Net.Core/Services/Raster/RasterService.cs#L560 , Lines: 560, 566, 567, 576) Reference: https://github.com/dem-net/DEM.Net/blob/168cd8e0e277793227f9cacd1cd26310ba495928/DEM.Net.Core/IO/Raster/GeoTiff.cs#L440

g0ro avatar Sep 21 '21 10:09 g0ro

Hi @g0ro, thanks for reporting this. Can you submit a PR ?

xfischer avatar Sep 29 '21 12:09 xfischer