2

We have a raster image with 9 discrete values. Generated the image using SAGA's Terrain Analysis -> Morphometry -> TPI classification technique. Now, like to merge pixels which occupy certain area (say less than 1 sq km) to the nearest maximum value. Eg, in the image - like to merge the white encircled ones to the nearest maximum value - 5 (Violet). enter image description here

Because, if i try to vectorize this image, it takes too much time (and not getting finished) to convert those pixels into polygons as there are so many polygons with less than 1 sq km. Our aim is to get a vector file from the classified raster.

Is there any workaround like, split the raster into four and then do the same raster -> vector conversion ? But still, it will have too many polygons to deal with i guess

  • 1
    I do not know if SAGA offers Maximum filter. There is one in Whitebox-GAT (image processing tools - filters) or in WhiteboxTools. Window size is defined by cells (x:cols, y:rows), not by distance. – Kazuhito Nov 12 '18 at 13:34
  • 1
    If your goal is to reduce noise from categorical data, I feel Majority Filter would give you more comfortable result... – Kazuhito Nov 12 '18 at 13:44
  • @Kazuhito Thanks mate. Yes, SAGA has "Maximum Filter" along with so many other filters (saga-gis.org/saga_tool_doc/2.2.2/grid_filter.html). I've applied the filter and you can see the result in my answer. – joseph_k Nov 13 '18 at 2:45
1

As suggested by @Kazuhito in the comment, i've applied "Majority Filter" (SAGA -> Geoprocessing -> Grid -> Filter) with 3 pixel radius and most of the "noise" were eliminated.

The same filter can also be applied within QGIS.

enter image description here

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.