IRasterProps.NoData doesn´t work whit Iraster2.GetPixelValue. Why?

512
2
11-14-2013 05:24 AM
Highlighted
Occasional Contributor
Hi i have code loke belov. I set NoData value to my pRaster (IRaster2) as value - 9999. but when i use GetPixelValue(0, x, y) at pixel location whit NoData i have value = 0.  do anybody know where is mistake? Or how to set my NoData Value correctly ?

dim pRaster as IRaster2
.
.
pRasPropsIn = CType(pRaster, IRasterProps)
pRasPropsIn.NoDataValue = -9999 'urcovanie hodnoty no data
.
.
dim pValue as Single
pValue = pRaster.GetPixelValue(0, x, y)

here is pValue = 0 not -9999 !!!!!!
Reply
0 Kudos
2 Replies
Highlighted
MVP Frequent Contributor
Having set the NoData value have you tried to save the raster first using ISaveAs to commit the change?  The help file says

These modifications only affect the in-memory raster representation and in no way change any of the raster dataset. You can persist the modifications to a new raster datast using ISaveAs::SaveAs or IRasterBandCollection::SaveAs.


Duncan
Reply
0 Kudos
Highlighted
Occasional Contributor
Thanks for reply, but i just need to check value at one point (x,y) and save whole raster is not a good idea, i think. What i need is know if the value is NoData or 0.
Reply
0 Kudos