Skip to content
Permalink
Browse files

Check if a point is 3D before returning its z value. Fixes #37772

  • Loading branch information
pblottiere committed Sep 28, 2020
1 parent 8d2a0d1 commit d1d156973be992a58992f3fa7111d8d3dd0fdfa8
Showing with 3 additions and 0 deletions.
  1. +3 −0 src/core/expression/qgsexpressionfunction.cpp
@@ -2349,6 +2349,9 @@ static QVariant fcnGeomZ( const QVariantList &values, const QgsExpressionContext
if ( geom.isNull() )
return QVariant(); //or 0?

if ( !geom.constGet()->is3D() )
return QVariant();

//if single point, return the point's z coordinate
if ( geom.type() == QgsWkbTypes::PointGeometry && !geom.isMultipart() )
{

0 comments on commit d1d1569

Please sign in to comment.
You can’t perform that action at this time.