RSyaoxin,<br><br>Check if poBand->GetNoDataValue() is actually returning a nodata value. If your raster has an out of range nodata value, there is going to be a problem. poBand->SetNoDataValue(nodata) will unset the nodata value if the nodata variable is out of range.<br>
<br><div class="gmail_quote">On Tue, Jul 12, 2011 at 7:48 PM, RSyaoxin <span dir="ltr"><<a href="mailto:RSyaoxin@hotmail.com">RSyaoxin@hotmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Hi,all<br>
I have a 32-float image with much "NoDatavalue",and I want to get the<br>
minimum value and maximum value.Here is my code:<br>
<br>
int bGotMin, bGotMax;<br>
double adfMinMax[2];<br>
<br>
double nodata=poBand->GetNoDataValue();<br>
poBand->SetNoDataValue(nodata);<br>
adfMinMax[0] = poBand->GetMinimum( &bGotMin );<br>
adfMinMax[1] = poBand->GetMaximum( &bGotMax );<br>
if( ! (bGotMin && bGotMax) )<br>
GDALComputeRasterMinMax(poBand, FALSE, adfMinMax);<br>
<br>
The maximum value(34.3386) I obtained that is right,but the minimum<br>
value is -1.#INF,not -61.990734. -61.990734 is what I want results. That's<br>
Why?I hope to get some help.<br>
Thank you!<br>
Kind regards.<br>
<font color="#888888"><br>
--<br>
View this message in context: <a href="http://osgeo-org.1803224.n2.nabble.com/GDALComputeRasterMinMax-Error-tp6575247p6575247.html" target="_blank">http://osgeo-org.1803224.n2.nabble.com/GDALComputeRasterMinMax-Error-tp6575247p6575247.html</a><br>
Sent from the GDAL - Dev mailing list archive at Nabble.com.<br>
_______________________________________________<br>
gdal-dev mailing list<br>
<a href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/gdal-dev" target="_blank">http://lists.osgeo.org/mailman/listinfo/gdal-dev</a><br>
</font></blockquote></div><br><br clear="all"><br>-- <br>Best regards,<br>Chaitanya kumar CH.<br><br>+91-9494447584<br>17.2416N 80.1426E<br>