DEM.Net
DEM.Net copied to clipboard
GetVirtualHeightMapInBBox does not work when DEMFileRegistrationMode is Cell
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
Hi @g0ro, thanks for reporting this. Can you submit a PR ?