I've got a DEM raster that I've analysed for slopes. I now need to generalise it, and it sounds like using gdal_sieve is the best way.

However, whenever I try to run it, the resulting raster is always entirely black. It seems to set each pixel to the NoValue value (in my case, -9999). My data is in floats, and goes from 0 to about 34.3 or something like that (apart from NoValues obviously).

I have used Raster>Conversion>Translate to get it to an integer, and also the Raster>Calculator to multiply the values by 100, but the results are still 0.

  • Which was the command that you use? – xunilk Mar 17 '17 at 9:40
  • I didn't use QGIS to get resulting raster. I directly use bash console in GNU/Linux Debian. – xunilk Mar 17 '17 at 11:24
  • I thought I had reproduced the error, but actually it was just a representation problem skewed by -9999 (confirmed by @xunilk, see 4th image). This is probably problem with latest QGIS. However, I am now wondering if it is also your case, as you have 0 with -9999. In both tests (@xunilk and myself ) original values were retained. Can you try it again? – Kazuhito Mar 19 '17 at 1:31

I don't know which was the command that you use but, in my case, I don't have any problem with mine. With next slope raster (Data Type: Float 32):

enter image description here

I ran next command with default values (in this case equivalent to -4):

gdal_sieve.py  utah_demUTM2_slope.tif new_output.tif

and I got:

enter image description here

It can be observed that new raster values are integers and between 1-100.

A detailed analysis by using Value Tool plugin of QGIS (see next image), it allows to observe that raster was well generalized.

enter image description here

Editing Note:

Based at Kazuhito commentary, I tried the command out by using GRASS console of QGIS 2.18.3. I got "apparently" no raster:

enter image description here

However, it's only a visualization problem. With pseudocolor and 7 new classes of next image, I have:

enter image description here

When I test it in my Windows 7 System (GDAL/OGR version'2.1.2'), I got again a visualization "problem". However, changing the minimum value of -9999 to 0, I have:

enter image description here

There is not a bug.

  • GDAL/OGR version of my windows QGIS - both 2.18.4 and 2.14.12 are 2.1.3. Older one (2.14.12) is compiled against GDAL/OGR 2.1.2. Can I ask your GDAL version? – Kazuhito Mar 17 '17 at 11:37
  • Please, see my Editing Note. It could help. By the way, my GDAL/OGR version is '1.10.1'. – xunilk Mar 17 '17 at 11:53
  • Woot, thanks! Then by (1) Going to Transparency tab, set nodata (e.g. -9999), then (2) going back to Style tab, reload min/max values by [Load] button, it seems to work. (At least for me.) Thanks again! – Kazuhito Mar 17 '17 at 12:04
  • I tested it in my Windows 7 system. I got good results. It isn't a bug. – xunilk Mar 17 '17 at 12:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.