dem-net/DEM.Net

GetVirtualHeightMapInBBox does not work when DEMFileRegistrationMode is Cell

Opened this issue · 1 comments

g0ro commented

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:

double latitude = metadata.DataEndLat + (metadata.pixelSizeY * y);
, Lines: 560, 566, 567, 576)
Reference:
double endLat = metadata.DataEndLat + metadata.pixelSizeY / 2d;

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