diff --git a/src/core/vectortile/qgsmapboxglstyleconverter.cpp b/src/core/vectortile/qgsmapboxglstyleconverter.cpp index 2f269e1907f2..35a960d3ec05 100644 --- a/src/core/vectortile/qgsmapboxglstyleconverter.cpp +++ b/src/core/vectortile/qgsmapboxglstyleconverter.cpp @@ -3428,6 +3428,10 @@ QString QgsMapBoxGlStyleConverter::parseExpression( const QVariantList &expressi { return QStringLiteral( "to_string(%1)" ).arg( parseExpression( expression.value( 1 ).toList(), context ) ); } + else if ( op == QLatin1String( "to-boolean" ) ) + { + return QStringLiteral( "to_bool(%1)" ).arg( parseExpression( expression.value( 1 ).toList(), context ) ); + } else if ( op == QLatin1String( "case" ) ) { QString caseString = QStringLiteral( "CASE" ); diff --git a/tests/src/python/test_qgsmapboxglconverter.py b/tests/src/python/test_qgsmapboxglconverter.py index e5082049f68f..92c784fdd74f 100644 --- a/tests/src/python/test_qgsmapboxglconverter.py +++ b/tests/src/python/test_qgsmapboxglconverter.py @@ -529,6 +529,9 @@ def testParseExpression(self): conversion_context), '''"name"''') + self.assertEqual(QgsMapBoxGlStyleConverter.parseExpression(["to-boolean", ["get", "name"]], + conversion_context), + '''to_bool("name")''') self.assertEqual(QgsMapBoxGlStyleConverter.parseExpression(["to-string", ["get", "name"]], conversion_context), '''to_string("name")''')