This project has moved and is read-only. For the latest updates, please go here.

Read image values

Topics: Data Access, SharpMap Project
Mar 14, 2015 at 4:11 PM
I'm new and have a question.
I have a load image:
SharpMap.Layers.GdalRasterLayer rasterLayer = new SharpMap.Layers.GdalRasterLayer("Image", @"C:\Users\Luis\Desktop\Image.ecw"); What I do now is read values. This image have 3 bands.
That Is, for the pixel, for example, 1x1, values of the 3 bands (200,5,30). And so for all pixels.
Mar 17, 2015 at 2:14 PM
Sth along these lines:
var fds = new SharpMap.Data.FeatureDataSet();
// build the raster layer
var rasterLayer = new SharpMap.Layers.GdalRasterLayer("Image", @"C:\Users\Luis\Desktop\Image.ecw");
// determine the extent of the layer
var extent = rasterLayer.[GetExtents()|Envelope];
// Execute intersection query, top, left corner = 0, 0
rasterLayer.ExecuteIntersectionQuery(new GeoAPI.Geometries.Envelope(extent.MinX, extent.MinX, extent.MaxY, extent.MaxY), fds);
// Get the feature data table
var fdt = (SharpMap.Data.FeatureDataTable)fds.Tables[0];
// this row contains the pixel values for each band
var fdr = (SharpMap.Data.FeatureDataRow)fdt.Rows[0];