-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wrong pixel value returned ? #10
Comments
As I did not see the attached file, I searched and arrived at this base: (https://dataverse.harvard.edu/file.xhtml?persistentId=doi:10.7910/DVN/QQHCIK/W8MYQO&version=4.0), is this correct? Assuming so, I verified that it is an 8-bit geotiff and I see in the code that this type of data was not handled: GeoTiffCOG/GeoTiffCOG/GeoTiff.cs Line 222 in efac2b5
case RasterSampleFormat.UNSIGNED_INTEGER:
if (metadata.BitsPerSample == 32)
{
heightValue = BitConverter.ToUInt32(buffer, offset * metadata.BitsPerSample / 8);
}
else // metadata.BitsPerSample == 16
{
heightValue = BitConverter.ToUInt16(buffer, offset * metadata.BitsPerSample / 8);
}
heightValue = heightValue * metadata.Scale + metadata.Offset;
break; |
… pixels don't bring the correct value, needs review related in #10
I made a small change, to return the byte value inside the "byteScanline" array. As a test suppose the following coordinate: 51.0, 8.3 (lat,lon); Which corresponds to the pixel 22596, 4364 (x,y). nearby at that location indicated on the map. The value (after commit) will return 9. However, it doesn't work well with some points that I took randomly, returning 255 (null value). We need to review this part of the code to support 8bit geotiff well. |
Some code improvements; related in #10
There is no mystery about 8bit support, in my example the points were very close to the border and the code that transforms coordinates into pixels needed an adjustment, which has now been resolved. @genaray please confirm if this version solves your problem, if so we can close this ticket. |
So i got it working, it works for the sample geotiff file.
However i wanna use it for my own files... its called "pnv_biome.type_biome00k_c_1km_s0..0cm_2000..2017_v0.1" and contains a value from 0 to 31 for each pixel. Basically natural vegetation and biomes.
When i run the program for my desired geocoordinate, it returns insanly high values. Wrong values. Furhermore, one single "GetElevationAtLAtLong" call generates about 500mb garbage.
Any help here ?
The text was updated successfully, but these errors were encountered: