I`d like to find out if and how it is possible to visualize LoD2 data (source:https://www.opengeodata.nrw.de/produkte/geobasis/3d-gm/) in QGIS 3.4/Madeira. So far I managed to load them into the project, but unlike other examples and tutorials I´ve seen, they come as lines instead of polygons. After enabling 3D for the layer and opening the 3D-View, it only "kind-of" worked with a second set of lines flying above the footprints - see screenshot (3D-View without background-map for a clearer image). So - unless there are issues with the data - I suppose I missed something... screenshot 2D/3D view

I also tried to convert them into polygons - first as original data and then after saving them as Esri-shapes, but the result was always that even the "polygons" came as "lines":screenshot "polygons"

Does anybody know if these data can be visualized with QGIS and if/how I have to prepare them or which steps in QGIS are necessary?

  • In order to visualize from the lines of a polygon go to the window named "Analysis Tools">>Vector Geometry">>"Build Polygons" and run it and see the result... Jan 4, 2020 at 14:08
  • Thank you, Cyril - I didn´t know about this function. Unfortunately now there are polygons instead of lines "flying" above the footprints and these polygons do not share the attributes of the line-features- unlike they do with the "lines to polygons" function. Jan 5, 2020 at 9:50
  • You can add attributes from the source table to a polygonal table... Jan 5, 2020 at 13:38
  • I know, and I tested it, but the "new" polygon-geometries are defect (according to the Error-message) Jan 5, 2020 at 17:33
  • 1
    1) Go to "Analysis Tools" >> "Vector Geometry">> "Merge Lines"; 2) On the "Menu" toolbar select "Vector">> "Geometry Processing">> "Convert Lines to Polygons...". Jan 5, 2020 at 17:54

1 Answer 1


Perhaps the line start and end points are not exactly identical, so they don't make a closed outline when converted to polygons. You can test this by using the expression is_closed($geometry) in the Select by Expression tool.

As a first workaround, try using the other line-to-polygon tool. (QGIS has two tools for converting lines to polygons: the native tool "Lines to polygons", and the SAGA tool "Convert lines to polygons.")

If neither tool works, proceed to fixing the non-closed outlines.

Try using the snap points to grid tool with a very small grid size. The trick is finding the right grid size that snaps all the start and endpoints to the same grid point without noticeably changing the shape of each polygon. That may take some trial and error. The ideal grid size will probably be about half the length of the gap between the start and end points.

Another possible solution is to add a short line connecting the end point to the start point. Note that this method requires a unique building ID field for the final step. If you don't have one, create it first.

  1. Use the Select by Expression tool to select non-closed lines with this expression:

    is_closed($geometry) = false
  2. Use the Geometry by Expression tool to create lines from the end point to the start point of the selected features (choose "selected features only), with this expression:

  3. Use the Merge Vector Layers tool to combine the original building outline layer with the new layer you created in the last step (be sure not to choose "selected features only" for this step)

  4. Use the Dissolve tool to combine the original building outlines with the new line segments, using the unique building ID field as the Dissolve field.

Once your building outlines are closed, use the Lines to Polygons tool to convert them into polygons.

  • Thank you cyril and csk, your hints were quite helpful in so far as my polygons now have the attributes of the lines and I have learnded again helpful things about geometry-tools. Unfortunately in the 3D view there are still just "flying polygons" instead of cubes. Jan 7, 2020 at 16:55
  • Isn't that the expected behavior for a polygon with a Z coordinate? If you want them to look like three-dimensional objects, try 2.5D symbology.
    – csk
    Jan 7, 2020 at 18:43

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.