Skip to content

Commit

Permalink
Be tolerant for multi points that aren't really multi
Browse files Browse the repository at this point in the history
  • Loading branch information
elpaso authored and github-actions[bot] committed Sep 20, 2021
1 parent 23412ff commit c2596a8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/core/expression/qgsexpressionfunction.cpp
Expand Up @@ -4174,7 +4174,7 @@ static QVariant fcnProject( const QVariantList &values, const QgsExpressionConte
{
QgsGeometry geom = QgsExpressionUtils::getGeometry( values.at( 0 ), parent );

if ( QgsWkbTypes::flatType( geom.wkbType() ) != QgsWkbTypes::Point )
if ( QgsWkbTypes::flatType( geom.constGet()->simplifiedTypeRef( )->wkbType() ) != QgsWkbTypes::Type::Point )
{
parent->setEvalErrorString( QStringLiteral( "'project' requires a point geometry" ) );
return QVariant();
Expand All @@ -4184,7 +4184,7 @@ static QVariant fcnProject( const QVariantList &values, const QgsExpressionConte
double azimuth = QgsExpressionUtils::getDoubleValue( values.at( 2 ), parent );
double inclination = QgsExpressionUtils::getDoubleValue( values.at( 3 ), parent );

const QgsPoint *p = static_cast<const QgsPoint *>( geom.constGet() );
const QgsPoint *p = static_cast<const QgsPoint *>( geom.constGet()->simplifiedTypeRef( ) );
QgsPoint newPoint = p->project( distance, 180.0 * azimuth / M_PI, 180.0 * inclination / M_PI );

return QVariant::fromValue( QgsGeometry( new QgsPoint( newPoint ) ) );
Expand Down

0 comments on commit c2596a8

Please sign in to comment.