GithubHelp home page GithubHelp logo

Wrong pixel value returned ? about geotiffcog HOT 3 OPEN

genaray avatar genaray commented on May 28, 2024
Wrong pixel value returned ?

from geotiffcog.

Comments (3)

fabric-io-rodrigues avatar fabric-io-rodrigues commented on May 28, 2024

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:

case RasterSampleFormat.UNSIGNED_INTEGER:

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;

from geotiffcog.

fabric-io-rodrigues avatar fabric-io-rodrigues commented on May 28, 2024

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.
sample_biome00k_c_1km

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.

from geotiffcog.

fabric-io-rodrigues avatar fabric-io-rodrigues commented on May 28, 2024

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.

from geotiffcog.

Related Issues (10)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.