I'm using QGIS 2.18.

I need to calculate the height of the rooftop of each building in a neighborhood. I have a vector shape of the buildings, with the building height attribute (from the ground to the top) and the shape of the contours (the height of the ground itself).

I need the information of the height of the ground of the centroid of each building and sum it into the height of the building in order to have the total height of the rooftop, in a shape of the buildings.

Here's a link to what I'm trying to do.

1 Answer 1


This is the general workflow that you can apply to get the results you want:

  • If you don't have a DEM for your study area, then you need to convert your contour line into raster. Use Interpolation plugin which is builtin plugin into QGIS from Raster -> Interpolation -> Interpolation, OR use v.surf.contour tool from GRASS. You can refer to this question: Generating DEM from isolines and spot heights using GRASS?
  • Convert the polygon buildings into centroids using Processing toolbox -> QGIS geoalgorithms -> Vector geometry tools -> Polygon centroids
  • Use Point sampling tool plugin to extract the pixel value of the raster generated in the first step to the centroids generated in the second step. Make sure that the projections of both raster file and centroid file are same.
  • Do a simple math by adding a new field and sum the building height field with the field that has the elevation extracted from previous step.
  • Use Join attributes by location from Vector -> Data Management Tools -> Join attributes by location to join the polygon buildings with point centroids so you can have the calculated roof height back to the polygon
  • Yeah, it worked perfectly! Here is the result. Nov 3, 2017 at 16:30
  • 1
    Please accept the answer if it solved your problem so that it can help others.
    – ahmadhanb
    Nov 4, 2017 at 14:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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