This project is read-only.

Loading Geotiff values to an object

Jun 3, 2014 at 8:20 PM
Here I am again with my questions...

This time I am trying to retrieve pixel values from a .tif file.
I couldn't use the Raster class (at least what I tried did'nt work),but could open the file by using a new GdalImage(path).
Now I want to read values from this file. As long as I could understand, the only methods available to read values from this GdalImage are GetColor and ReadBlock. However, those methods end up with RGB values (from Bitmap objects). What I need are the original floating point values. Is there a way to get them?
Jun 3, 2014 at 9:02 PM
Found a way using RasterProvider:
GdalRasterProvider provider = new GdalRasterProvider();
IRaster raster = provider.Open(pathtotif);
raster = raster.ReadBlock(0, 0, 1, 1); //to read a rectangular block of values to a new subraster
double val = raster.value[1,1]; // This reads a single value
Marked as answer by Marciolegal on 6/3/2014 at 1:02 PM
Jun 5, 2014 at 9:58 AM
btw, why you need raster.ReadBlock()?
you can get value directly from original raster:

IRaster raster = provider.Open(pathtotif);
double val = raster.value[i, j];
Jun 5, 2014 at 3:03 PM
Yes, just to show the two different ways of accessing pixel values. At first I didn't know you can use indices.
Does the DotSpatial team plan to update the documentation anytime soon (chm file)? I noticed it is quite outdated - e.g. some methods and properties do not exist for some of the classes, etc. I also noticed theres no (sufficient) decription for some of the main classes, which sometimes makes the some of the classes hard to understand without help, but they turn out to be really easy to use, just as in this example. DotSpatial is definitely the main open source C# Geospatial project out there, and If you could come out with something like Microsoft MSDN as documentation (:D), that would so rocket launch it.
Jun 5, 2014 at 5:22 PM
Yes, we are know that documentation is poor and in many places is out of date...