[Qgis-developer] min/max for rasters

Radim Blazek radim.blazek at gmail.com
Mon Dec 16 01:42:26 PST 2013

On Mon, Dec 16, 2013 at 8:41 AM, Vincent Schut <schut at sarvision.nl> wrote:
> On 12/14/13 07:17, Paolo Cavallini wrote:
>> Il 13/12/2013 20:18, Radim Blazek ha scritto:
>>>> Can you describe some examples where 2-98% is a problem (data type,
>>>> number of bands, map content, features/phenomena represented by those
>>>> 2+2%,...) so that we can think about it better?
>> Example #1 (less problematic): dtm and their legend are always shown
>> wrong; newbies do not understand why
>> Example #2 (more serious): rasterizing sparse vectors (e.g. rivers)
>> results in a black rectangle, as the number of pixels with valid data is
>> <2%.
>> In fact, I think we should help users more, e.g. by applying non linear
>> colour scaling (log, exp)  in case of very skewed raster values
>> distribution: if data are more or less normally distributed, no cut is
>> applied, and linear scaling is used; if they are badly skewdw or with
>> outliers, apply a non linear colour scaling. With some thinking, this
>> should solve most if not all user cases, without asking a normal user to
>> understand much about raster stats.
>> However, in my case the general setting "use min/max" does not seem to
>> be working.
>> Thanks for your thoughts.
> Imho, a lot could be derived from the image metadata: datatype, number of
> bands, 'photographic interpretation', etc.
> - for 3 bands, 8 bit, assume rgb and do not stretch
> - for 4 bands, 8 bit, assume rgba and do not stretch
> - more bands and/or datatypes >8bit or float: usually means satellite
> imagery. I'd say, start with a stretch of 2-98%. Users of satellite imagery
> mostly know what to do when their image then still appears black, I think?
> - 1 band data, >8bit: probably conitnuous data, possibly a dtm/dem, apply a
> stretch, maybe also 2-98 %? Of course all nodata pixels should be excluded
> from the 2-98% calculations.
> - 1 band data, 8bit: probably sparse or 'class' data: discrete, might have
> lots of actual nodata values. A good default strategy might be to apply a
> random or default colormap.

Have you tried to run QGIS 2.0? I think that most of what you are
suggesting is default and you can change the defaults if you want in:
Settings > Options > Rendering > Rasters
Missing is identification of discreet data.

> Personally, I would refrain from non-linear stretch types as default. When I
> open a raster, I do not want too much 'intelligence' to happen. Also, I
> usually find the x-y% type of stretching more useful than the -x +y stdev
> type of streching, but that might have to do with the datasets I usually
> work with.
> Problems of course arise when people/programs do not correctly set nodata
> values, etc. (e.g. in the case of rasterizing sparse vectors, all other
> pixels should be nodata). I'd say, do not build in too much intelligence to
> correct for things like that, in the end it only makes things more
> complicated.

I also hate programs which "intelligently" do something what I don't
want. OTOH I also hate application which are not able to do some very
simple task like render a raster so that I can see more than black
rectangle. Unfortunately such simple task appears to be quite
complicated. In this situation I would prefer first to try to improve
style decision instead of resign completely.


> My 2 cents.
> Best,
> Vincent Schut.
> _______________________________________________
> Qgis-developer mailing list
> Qgis-developer at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-developer

More information about the Qgis-developer mailing list