Le jeudi 15 mai 2014 16:25:12, Stephen Woodbridge a écrit : > Hi all, > > I'm trying to create a VRT file for a GTiff that is Int32 or Float32 to > add a ColorTable but I seem to be missing a key piece of information. > How are the pixel values mapped to the color table entries? via the > histogram? > > My GTiff has noData=-32767 and good values the range from say -5 to 100. > So do I create a color table that is based on the 256 buckets in the > histogram?
No way you can use a GDAL color table to map negative values... Perhaps you should use gdaldem color-relief to generate a RGB output. Note that gdaldem color-relief is compatible with VRT output : it uses the LUT mechanism to do so. > > So for example I get: > > Band 1 Block=256x256 Type=Float32, ColorInterp=Gray > Min=-32767.000 Max=33.980 Computed Min/Max=-54.985,34.320 > Minimum=-32767.000, Maximum=33.980, Mean=-15887.345, StdDev=16386.592 > 256 buckets from -32831.1 to 98.0444: > 1545169 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 > 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 > 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 > 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 > 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 > 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 > 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 > 0 0 0 0 0 0 27375 1924356 > NoData Value=-32767 > Metadata: > STATISTICS_MAXIMUM=33.979999542236 > STATISTICS_MEAN=-15887.344614501 > STATISTICS_MINIMUM=-32767 > STATISTICS_STDDEV=16386.59208246 > > > It seems that the NoData value is included in the stats which really > skews the numbers compressing all my values into two buckets! How can I > avoid that? I want to ignore the NoData values and spread my good values > into the remaining buckets. How can I do this? You can't. There's a ticket I think about the fact we should ignore nodata value in stats. > > Thanks, > -Steve > > _______________________________________________ > gdal-dev mailing list > [email protected] > http://lists.osgeo.org/mailman/listinfo/gdal-dev -- Geospatial professional services http://even.rouault.free.fr/services.html _______________________________________________ gdal-dev mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/gdal-dev
