I am new to osgEarth.I want to use GDAL to process the image data(the source are tifs) and get the elevation of each pixel，then I can use the elevation data directly in osgEarth .But the value is different from the height in osgEarth(using tms driver),I want to know how the data changes but just found that height field data is loaded from source.
The code is in osg::HeightField* TileSource::createHeightField(const TileKey& key, ProgressCallback* progress).
The function I'm using is GDALRasterBand::RasterIO.I don't know why the value is different from the heightfield.
So, my question now is:
1)Why are they different? How does the value change?
2) How can I get the same height value using GDAL as in osgearth?
My english is not so good, I hope you understand my question.
First, the osg::Array you are looking at is a 17x17 vertex mesh; so the values are being interpolated to match the vertex positions.
Second, GDAL::RasterIO returns image data with an upper-left origin. The osgEarth data has a lower-left origin (OpenGL convention) and osgEarth flips it vertically after reading it with GDAL::RasterIO.