View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0000750 | Heureka | Visualisation StandWise | public | 2025-01-13 08:25 | 2025-01-24 14:51 |
Reporter | Peder | Assigned To | osskyn | ||
Priority | normal | Severity | minor | Reproducibility | always |
Status | assigned | Resolution | open | ||
Product Version | 2.23.0.2 | ||||
Summary | 0000750: Error when opening DTM height model | ||||
Description | An error occurs when I try to open a digitial terrain model in Standwise 3D-view. "Could not read the raster contents of the file..." | ||||
Steps To Reproduce | In Standwise 3D view, choose "Load height model" and select attached file. | ||||
Tags | No tags attached. | ||||
Attached Files | |||||
Product | StandWise | ||||
|
Error seems to be that the library BitMiracle.LibTiff does not support 64-bit samples which the provided file is. |
|
Lite testdata (dock i 32bit inte 64bit). Frågor 1. Borde FromGeoTiff användas i stället för FromTiff? 2. Var är rätt skalning? Nu är heightscale till HeighMap.cs alltid 10.0 men borde väl snarare vara 1.0? 3. Något spännande verkar hända med marktexturen på sina håll. Utkast för ReadTiffRaster(...): private void ReadTiffRaster(string path, Tiff file) { int imageSize = Width * Height; int[] raster = new int[imageSize]; _heights = new float[imageSize]; int bitsPerSample = 8; // default to 8 if (file.GetField(TiffTag.BITSPERSAMPLE) is FieldValue[] bpsField) bitsPerSample = bpsField[0].ToInt(); byte[] buffer = new byte[file.ScanlineSize()]; if (bitsPerSample == 64) { // Read raw scanlines as 64-bit floating-point data for (int y = 0; y < Height; ++y) { file.ReadScanline(buffer, y); for (int x = 0; x < Width; ++x) { int pixelIndex = y * Width + x; int bufferIndex = x * 8; // Each sample is 8 bytes (64 bits) // Convert the 64-bit value (double) double value = BitConverter.ToDouble(buffer, bufferIndex); // Scale and store as float _heights[pixelIndex] = (float)((value - Minsta_höjd_här + 1) * _scale.Y); } } } else if (bitsPerSample == 32) { // Read raw scanlines as 32-bit floating-point data for (int y = 0; y < Height; ++y) { file.ReadScanline(buffer, y); for (int x = 0; x < Width; ++x) { int pixelIndex = y * Width + x; int bufferIndex = x * 4; // Each sample is 4 bytes (32 bits) // Convert the 32-bit value (float) float value = BitConverter.ToSingle(buffer, bufferIndex); // Scale and store as float _heights[pixelIndex] = (value - Minsta_höjd_här + 1) * _scale.Y; } } } else { for (int y = 0; y < Height; ++y) { file.ReadScanline(buffer, y); for (int x = 0; x < Width; ++x) { int pixelIndex = y * Width + x; // Decode based on bitsPerSample if (bitsPerSample == 8) { _heights[pixelIndex] = (buffer[x] - Minsta_höjd_här + 1) * _scale.Y; } else if (bitsPerSample == 16) { int value = BitConverter.ToUInt16(buffer, x * 2); _heights[pixelIndex] = (value - Minsta_höjd_här + 1) * _scale.Y; } else { throw new NotSupportedException($"Unsupported bits per sample: {bitsPerSample}"); } } } } } |
Date Modified | Username | Field | Change |
---|---|---|---|
2025-01-13 08:25 | Peder | New Issue | |
2025-01-13 08:25 | Peder | File Added: DTM 66E9j3317.tiff | |
2025-01-14 16:02 | osskyn | Note Added: 0000635 | |
2025-01-17 10:50 | jonare | Note Added: 0000636 | |
2025-01-17 10:50 | jonare | File Added: heightMap_Testdata.zip | |
2025-01-17 10:51 | jonare | Product Version | 2.23.1 => 2.23.0.2 |
2025-01-24 14:51 | osskyn | Assigned To | => osskyn |
2025-01-24 14:51 | osskyn | Status | new => assigned |