4

I have created rasters showing different types of vegetation (bushes, trees, open land) with help from lidar data. Now I'm looking for a method to turn these images into polygons.

I'm using a Mac and preferably QGIS, GDAL, GRASS etc. I do have the possibility to use Windows but I'd prefer staying in Mac OS X.

Here is the source image: source image

Blue (with some red) means trees and red is bushes. White is open land.

And this image (drawn by hand) is kind of what I'd like to achieve: target image

Any ideas?

I've tried r.neighbors some but I'm not satisfied.

Update: I have now tried Majority and it looks better. But the narrow part in the south east part is not being included. I guess those dots are not in "majority". How could I make them being included? It's like if I need minority but not extreme minority...

See image below (note that I have only included bushes, the red color from the original image):

majority

5

You can use a Majority Filter followed by Polygonize for this type of operation. QGIS has a majority filter in the SAGA toolbox. Polygonize is found in the Raster tab > Conversion > Polygonize (Raster to Vector...). For more cartographically pleasant vector features, use Simplify Geometry to smooth the rough vector edges: Vector > Geometry Tools > Simplify Geometries...

enter image description here


enter image description here


Another option is to use a Guassian Filter in the SAGA toolbox and then threshold that output using the Raster Calculator. In this second example, I used a double pass circular Guassian Filter with a stdev of 3 and a search radius of 30. I then thresholded the resulting image using the following syntax in the raster calculator:

"Filtered Grid@1" > 0.7

The resulting output is overlaid in transparent blue on the original:

enter image description here

| improve this answer | |
  • Thanks! But when I have a radius larger than 8 the image becomes all black. And with smaller values it's not very satisfying. How's that? any ideas? – oskarlin Jul 10 '15 at 11:40
  • Noticed now if I use a smaller area it works with larger values. Does it have some kind of memory limit? I mean I have 16 gb ram... – oskarlin Jul 10 '15 at 11:49
  • I would advise subsetting your original raster in order to test. Then dial in the parameters until the desired effect is achieved. – Aaron Jul 10 '15 at 11:54
  • I have now tried the majority filter and it's promising. But it doesn't seem to catch all my features. Look at the added image above. It misses the part in south east and in east where the density isn't as big as in the middle. I guess because it's not in "majority". But how can I include them too? – oskarlin Jul 10 '15 at 15:30
  • @OskarKarlin I edited the answer to include another method for generalizing raster data. You will likely need to play around with the parameters to get what you want. – Aaron Jul 10 '15 at 16:38

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.