[GIS] how to map/drape polygon layers over raster in QGIS

2d3dqgisrastervector

I want to "map" or "drape" a 2D vector (polygon) over a raster. Obtaining a 3D vector with z-values according to the raster it's draped over.

Most of my internet findings point towards v.drape.
However, this tool seems to only work for polylines, not polygons. Furthermore I am looking for functionality similar to that of ArcGIS 3D-Analyst ("interpolate shape"), where points are inserted in every new raster cell with an according height.
Is there a similar tool or combination of tools to achieve this?

Unfortunately, converting the polygon to polylines, draping it and converting it back to polygon does not seem to work either, as the Z-values get lost.

QGIS 2.18.16

Best Answer

You cannot create a new dataset containing a "draped" polygon. Fundamentally speaking, a polygon MUST have all of its point in an arbitrary 2D plane.

As per the OGC's "Simple Features Specification":

2.1.10 Polygon A Polygon is a planar Surface, defined by 1 exterior boundary and 0 or more interior boundaries. Each interior boundary defines a hole in the Polygon.

"Planar" means that it is completely level or flat.

The closest thing you can come to a "draped" polygon stored as a dataset is a TIN, for which there is a guide using QGIS found here, or to maintain the data in raster format. You can use the results of either to query at x,y coordinates to return a z coordinate on the fly.

There are ways to visualize a draped polygon in 3D, but this is done by rendering and recoloring a raster or TIN using the polygon.

Related Question