I have a shapefile with a MultiLineStringZ
geometry type that I created using the grass v.drape function to attach z-values from a DEM. In order to calculate the 3d length of a line segment, can I use the $length
function in the QGIS field calculator, or will this function only report the 2D length?
2 Answers
For QGIS versions QGIS 3.20 and greater
Now one can calculate the 3D length of a MultiLineStringZ
with the length3D($geometry)
function, see the Changelog for QGIS 3.20 for more details.
For QGIS versions lower than QGIS 3.20
No, the $length
function only reports lengths from 2d geometries.
$length
value. Maybe submit a documentation issue to make this explicit in the help if it is the case? Also, I can't find a function or plugin that says it can measure 3d line lengths for things with Z geometry.