5

I have a shapefile containing buildings represented as polygons (basically the area of the buildings).

In the attribute table there is a field where the elevation of every building is stored (every building/polygon as a different elevation). Elevations are stored as decimal numbers.

What I am trying to do, is to convert this 2D shapefile in a 3D shapefile using the elevations stored in the "z" field of the shapefile.

With ArcGis it is possible with the tool Feature to 3D by attribute

I cannot find anything similar in QGIS.

I tried "save as" and then include "z dimension" but it does not prompt to choose a field where elevations are stored.

I also tried the v.extrude Grass command, but none of the field in the attribute table are shown to select from as height field.

Is it possible with QGIS/Grass to do this?

My final goal is to obtain buildings as 3D objects.

2

1 Answer 1

6

I guess if you have None as a value for the v.extrude command, it's because your data is not in the right format (string instead of real for example). See below, it works for me :

v.extrude

In case you need, GRASS has a v.to.3d command that transforms 2d vectors to 3d vectors. It'll pass Point into PointZ or Polygon to PolygonZ.

v.to.3d - Performs transformation of 2D vector features to 3D.

See https://grass.osgeo.org/grass72/manuals/v.to.3d.html

v.to.3d

6
  • Just checked, my elevation data are stored in a field type "double", type name "real", precision "2", lenght "10".
    – Vale
    Sep 8, 2017 at 8:15
  • Ok, I managed to make it work using GRASS inside of QGIS, and not in the GRASS GUI. The extrusion of some of the buildings failed, but in the GRASS GUI I can see the others as 3D. I don't know why the SAME exact command worked inside QGIS and not inside the GRASS GUI. Now I will have to adjust the buildings that where not extruded and find a way to export them to be used outside of GRASS.
    – Vale
    Sep 8, 2017 at 8:22
  • 1
    @Vale I think i already ran into this type of strange behavior, where the software didn't recognize double field type, but it did recognize real field type.
    – gisnside
    Sep 8, 2017 at 18:46
  • 2
    Hi all, I'm totally new here and totally new to the world of GIS. I've had a similar problem but I wanted the footprints to be at the correct elevation and for the extrusions to have correct heights. Fortunately my input shape file had the right data. I ended up doing this in two passes. First I used the VectorGeometry.Translate process to move the footprints to their correct elevations. Then I used the v.extrude process on the resulting translated layer to extrude the footprints. It worked perfectly. All this in QGIS 3.2.2-Bonn
    – Tomek
    Sep 14, 2018 at 1:15
  • Further to my previous comment, after exporting to DXF format in order to import into my architectural application, it turns out that the extruded footprints appear as wireframes. I was hoping to get boxes with filled sides, if that makes sense. Anyone know how to do that?
    – Tomek
    Sep 15, 2018 at 10:20

Your Answer

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

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