# Simplifying land cover classification in QGIS?

I have recently completed a land use classification using over 100 ROIs for 5 different land cover classes and it has developed what looks like a highly specific spectral signature for each class. This has meant that the classification is almost like a series of disconnected coloured squares (see pic). It would be great if, for example, similar pixels surrounding or next to a different pixel could convert it to the same class so as to show more contiguous classes. Any ideas?

Green = forest Purple = sub canopy cultivation blue = degraded forest cyan = monoculture yellow = village

enter image description here

• You should take a look at "Majority Filter" from SAGA, in QGis. – Mikkel Lydholm Rasmussen Jul 6 '16 at 11:04
• Thanks very much for your time in making the suggestion. I tried a majority filter and also a sieve analysis. the latter of which I will use for the input of a vectorise conversion. I found the Sieve function much easier to interpret and therefore get the results I wanted. – Archie Fisher Jul 7 '16 at 7:34
• You should write up your findings and post them as an answer to your own question. This will allow you to mark that as the correct answer, which will close the question, instead of leaving it open as it is now. – Mikkel Lydholm Rasmussen Jul 7 '16 at 8:39
• Through "Processing" in QGIS you could vectorize the map and then run v.clean of GRASS GIS: grass.osgeo.org/grass72/manuals/v.clean.html#remove-small-areas – markusN Oct 25 '16 at 7:53

In QGIS I tried a majority filter (Processing>toolbox>geoalgorithms>filters) and also a sieve analysis (Raster>analysis). I found the Sieve function much easier to interpret and therefore get the results I wanted, especially when using the 4 or 8 connecting pixels function. This reduced a lot of the noise and gave a more interpretable sense of majority land covers within each area. I will use this output to create a generalised vector land cover map.

i think you can use RStudio to reclassify multiple class to the class you wish and the syntax is very simple.

step 1. In (ArcGIS or QGIS) attribute table check the similar classes and write it in your note book.

step 2. Install R and RStudio and open it in your desktop

step 3. copy and paste the below script and change the required field and change the classes according to your need,. ps. in (r= 1) 1 is equal to class which need to be reclassified # 2 is equal to class which is the destination.

setwd("**set the working folder path here**")
install.packages("raster")
library("raster")
r<- raster("***give your raster file path iside the inverted comma here***")

r[r=1] <- 2

r[r=3] <- 2

r[r=3] <- 4

r[r=5] <- 6

r[r=7] <- 8

r[r=9] <- 10

writeRaster(r, filename="ReclassifiedLandcoverfile.tif", format="GTiff", overwrite=TRUE)

• Welcome to GIS SE! As a new user be sure to take the Tour to learn about our focussed Q&A format. The asker makes no mention of using R and RStudio. – PolyGeo Nov 17 '17 at 9:36