I am trying to map all the flat roofs of a city. After processing my data I have a huge raster with the zones that are flat (=1) and not flat (=0). I can overlap the roof polygons over this raster and I can see what zones of the roofs are flat.

enter image description here

The problem is that I have a lot of roof peaks which are considered as flat (this corresponds to the long white stripes on the raster image). I would like to clean these roof peaks WITHOUT polygonizing my rasters (too heavy process for my huge files).

I was thinking to calculate for each flat part of the roof: Area/Perimeter=x < coefficient. I could already calculate the area of the flat surfaces with zonal statistics but I cannot find a way to calculate the perimeter of the flat areas within the roof.

Is there a way to achieve this?

Would you have another approach to identify the roof peaks on this raster without polygonizing it?

  • 1
    To get rid of the small (1 pixel up to 10 pixel connected for example) you can use the Sieve tool coming along with the GDAL library. This still doesn't take into account the perimeter of the roofs. See also: gis.stackexchange.com/questions/251495/…. – Stefan Aug 9 at 13:50
  • Just a thought, not a tested answer - maybe zonal stats with roof polygons as the zones, flat surface raster as the values and mean/average as the statistic. Means closer to 1.0 will be mostly flat. – Luke Aug 10 at 0:38
  • +1 for Stefan's coment, sieve is the best tool for the first part of your job in QGIS. It will remove the noise from your raster. The second part is a bit more tricky to do without polygonizing your raster in QGIS. in ArcGIS there is a tool called Zonal Geometry that can do area and perimeter for continguous groups of cells in a raster but I am yet to find the equivalent in QGIS/SAGA/GRASS. – Phil Barlow Aug 10 at 8:00
  • I have done "sieve" it removed a part of the small surfaces but unfortunately, many roof peaks remain.. I would be really interested in knowing the Zonal geometry tool for QGIS.I will also test the mean/average value if it's relevant. thank you! – Md01 Aug 10 at 12:48
  • I've found an interesting article, which explains how to measure the size of objects in an images. You have to install additional Python packages. pyimagesearch.com/2016/03/28/…. – Stefan Aug 14 at 11:44

Your Answer

 
discard

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.