diff --git a/resources/function_help/json/contains b/resources/function_help/json/contains index 93d58ac0ea9..3545a19378a 100644 --- a/resources/function_help/json/contains +++ b/resources/function_help/json/contains @@ -2,9 +2,9 @@ "name": "contains", "type": "function", "groups": ["GeometryGroup"], - "description": "Tests whether a geometry contains another. Returns true if and only if no points of geometry b lie in the exterior of geometry a, and at least one point of the interior of b lies in the interior of a.", - "arguments": [ {"arg":"geometry a","description":"a geometry"}, - {"arg":"geometry b","description":"a geometry"}], + "description": "Tests whether a geometry contains another. Returns true if and only if no points of geometry2 lie in the exterior of geometry1, and at least one point of the interior of geometry2 lies in the interior of geometry1.", + "arguments": [ {"arg":"geometry1","description":"a geometry"}, + {"arg":"geometry2","description":"a geometry"}], "examples": [ { "expression":"contains( geom_from_wkt( 'POLYGON((0 0, 0 1, 1 1, 1 0, 0 0))' ), geom_from_wkt( 'POINT(0.5 0.5 )' ) )", "returns":"true"}, { "expression":"contains( geom_from_wkt( 'POLYGON((0 0, 0 1, 1 1, 1 0, 0 0))' ), geom_from_wkt( 'LINESTRING(3 3, 4 4, 5 5)' ) )", "returns":"false"} ] diff --git a/resources/function_help/json/crosses b/resources/function_help/json/crosses index 2ffa627d061..6806ecb7179 100644 --- a/resources/function_help/json/crosses +++ b/resources/function_help/json/crosses @@ -3,8 +3,8 @@ "type": "function", "groups": ["GeometryGroup"], "description": "Tests whether a geometry crosses another. Returns true if the supplied geometries have some, but not all, interior points in common.", - "arguments": [ {"arg":"geometry a","description":"a geometry"}, - {"arg":"geometry b","description":"a geometry"}], + "arguments": [ {"arg":"geometry1","description":"a geometry"}, + {"arg":"geometry2","description":"a geometry"}], "examples": [ { "expression":"crosses( geom_from_wkt( 'LINESTRING(3 5, 4 4, 5 3)' ), geom_from_wkt( 'LINESTRING(3 3, 4 4, 5 5)' ) )", "returns":"true"}, { "expression":"crosses( geom_from_wkt( 'POINT(4 5)' ), geom_from_wkt( 'LINESTRING(3 3, 4 4, 5 5)' ) )", "returns":"false"} ] diff --git a/resources/function_help/json/difference b/resources/function_help/json/difference index 3bb764d8424..91bf3db6eb4 100644 --- a/resources/function_help/json/difference +++ b/resources/function_help/json/difference @@ -2,8 +2,8 @@ "name": "difference", "type": "function", "groups": ["GeometryGroup"], - "description": "Returns a geometry that represents that part of geometry_a that does not intersect with geometry_b.", - "arguments": [ {"arg":"geometry_a","description":"a geometry"}, - {"arg":"geometry_b","description":"a geometry"}], + "description": "Returns a geometry that represents that part of geometry1 that does not intersect with geometry2.", + "arguments": [ {"arg":"geometry1","description":"a geometry"}, + {"arg":"geometry2","description":"a geometry"}], "examples": [ { "expression":"geom_to_wkt( difference( geom_from_wkt( 'LINESTRING(3 3, 4 4, 5 5)' ), geom_from_wkt( 'LINESTRING(3 3, 4 4)' ) ) )", "returns":"LINESTRING(4 4, 5 5)"} ] } diff --git a/resources/function_help/json/disjoint b/resources/function_help/json/disjoint index ebd8db7fa44..bb5fcd88a52 100644 --- a/resources/function_help/json/disjoint +++ b/resources/function_help/json/disjoint @@ -3,8 +3,8 @@ "type": "function", "groups": ["GeometryGroup"], "description": "Tests whether geometries do not spatially intersect. Returns true if the geometries do not share any space together.", - "arguments": [ {"arg":"geometry a","description":"a geometry"}, - {"arg":"geometry b","description":"a geometry"}], + "arguments": [ {"arg":"geometry1","description":"a geometry"}, + {"arg":"geometry2","description":"a geometry"}], "examples": [ { "expression":"disjoint( geom_from_wkt( 'POLYGON((0 0, 0 1, 1 1, 1 0, 0 0 ))' ), geom_from_wkt( 'LINESTRING(3 3, 4 4, 5 5)' ) )", "returns":"true"}, { "expression":"disjoint( geom_from_wkt( 'LINESTRING(3 3, 4 4, 5 5)' ), geom_from_wkt( 'POINT(4 4)' ))", "returns":"false"} ] diff --git a/resources/function_help/json/distance b/resources/function_help/json/distance index 533de9d90da..d2c57de1992 100644 --- a/resources/function_help/json/distance +++ b/resources/function_help/json/distance @@ -3,8 +3,8 @@ "type": "function", "groups": ["GeometryGroup"], "description": "Returns the minimum distance (based on spatial ref) between two geometries in projected units.", - "arguments": [ {"arg":"geometry a","description":"a geometry"}, - {"arg":"geometry b","description":"a geometry"}], + "arguments": [ {"arg":"geometry1","description":"a geometry"}, + {"arg":"geometry2","description":"a geometry"}], "examples": [ { "expression":"distance( geom_from_wkt( 'POINT(4 4)' ), geom_from_wkt( 'POINT(4 8)' ) )", "returns":"4"} ] } diff --git a/resources/function_help/json/hausdorff_distance b/resources/function_help/json/hausdorff_distance index 6366a9fe49e..30c80026604 100644 --- a/resources/function_help/json/hausdorff_distance +++ b/resources/function_help/json/hausdorff_distance @@ -3,8 +3,8 @@ "type": "function", "groups": ["GeometryGroup"], "description": "Returns the Hausdorff distance between two geometries. This is basically a measure of how similar or dissimilar 2 geometries are, with a lower distance indicating more similar geometries.
The function can be executed with an optional densify fraction argument. If not specified, an approximation to the standard Hausdorff distance is used. This approximation is exact or close enough for a large subset of useful cases. Examples of these are:

  • computing distance between Linestrings that are roughly parallel to each other, and roughly equal in length. This occurs in matching linear networks.
  • Testing similarity of geometries.


  • If the default approximate provided by this method is insufficient, specify the optional densify fraction argument. Specifying this argument performs a segment densification before computing the discrete Hausdorff distance. The parameter sets the fraction by which to densify each segment. Each segment will be split into a number of equal-length subsegments, whose fraction of the total length is closest to the given fraction. Decreasing the densify fraction parameter will make the distance returned approach the true Hausdorff distance for the geometries.", - "arguments": [ {"arg":"geometry a","description":"a geometry"}, - {"arg":"geometry b","description":"a geometry"}, + "arguments": [ {"arg":"geometry1","description":"a geometry"}, + {"arg":"geometry2","description":"a geometry"}, {"arg":"densify_fraction","description":"densify fraction amount", "optional":true}], "examples": [ { "expression":"hausdorff_distance( geometry1:= geom_from_wkt('LINESTRING (0 0, 2 1)'),geometry2:=geom_from_wkt('LINESTRING (0 0, 2 0)'))", "returns":"2"}, { "expression":"hausdorff_distance( geom_from_wkt('LINESTRING (130 0, 0 0, 0 150)'),geom_from_wkt('LINESTRING (10 10, 10 150, 130 10)'))", "returns":"14.142135623"}, diff --git a/resources/function_help/json/intersects b/resources/function_help/json/intersects index fd2381ed74d..b63af71c97f 100644 --- a/resources/function_help/json/intersects +++ b/resources/function_help/json/intersects @@ -3,8 +3,8 @@ "type": "function", "groups": ["GeometryGroup"], "description": "Tests whether a geometry intersects another. Returns true if the geometries spatially intersect (share any portion of space) and false if they do not.", - "arguments": [ {"arg":"geometry a","description":"a geometry"}, - {"arg":"geometry b","description":"a geometry"}], + "arguments": [ {"arg":"geometry1","description":"a geometry"}, + {"arg":"geometry2","description":"a geometry"}], "examples": [ { "expression":"intersects( geom_from_wkt( 'POINT(4 4)' ), geom_from_wkt( 'LINESTRING(3 3, 4 4, 5 5)' ) )", "returns":"true"}, { "expression":"intersects( geom_from_wkt( 'POINT(4 5)' ), geom_from_wkt( 'POINT(5 5)' ) )", "returns":"false"} ] diff --git a/resources/function_help/json/overlaps b/resources/function_help/json/overlaps index bf085c94a42..85bfcf415b3 100644 --- a/resources/function_help/json/overlaps +++ b/resources/function_help/json/overlaps @@ -3,8 +3,8 @@ "type": "function", "groups": ["GeometryGroup"], "description": "Tests whether a geometry overlaps another. Returns true if the geometries share space, are of the same dimension, but are not completely contained by each other.", - "arguments": [ {"arg":"geometry a","description":"a geometry"}, - {"arg":"geometry b","description":"a geometry"}], + "arguments": [ {"arg":"geometry1","description":"a geometry"}, + {"arg":"geometry2","description":"a geometry"}], "examples": [ { "expression":"overlaps( geom_from_wkt( 'LINESTRING(3 5, 4 4, 5 5, 5 3)' ), geom_from_wkt( 'LINESTRING(3 3, 4 4, 5 5)' ) )", "returns":"true"}, { "expression":"overlaps( geom_from_wkt( 'LINESTRING(0 0, 1 1)' ), geom_from_wkt( 'LINESTRING(3 3, 4 4, 5 5)' ) )", "returns":"false"} ] diff --git a/resources/function_help/json/touches b/resources/function_help/json/touches index 66c5d95883e..4d68d9bd635 100644 --- a/resources/function_help/json/touches +++ b/resources/function_help/json/touches @@ -3,8 +3,8 @@ "type": "function", "groups": ["GeometryGroup"], "description": "Tests whether a geometry touches another. Returns true if the geometries have at least one point in common, but their interiors do not intersect.", - "arguments": [ {"arg":"geometry a","description":"a geometry"}, - {"arg":"geometry b","description":"a geometry"}], + "arguments": [ {"arg":"geometry1","description":"a geometry"}, + {"arg":"geometry2","description":"a geometry"}], "examples": [ { "expression":"touches( geom_from_wkt( 'LINESTRING(5 3, 4 4)' ), geom_from_wkt( 'LINESTRING(3 3, 4 4, 5 5)' ) )", "returns":"true"}, { "expression":"touches( geom_from_wkt( 'POINT(4 4)' ), geom_from_wkt( 'POINT(5 5)' ) )", "returns":"false"} ] diff --git a/resources/function_help/json/within b/resources/function_help/json/within index d2eec468d60..03ebf5b98a0 100644 --- a/resources/function_help/json/within +++ b/resources/function_help/json/within @@ -2,9 +2,9 @@ "name": "within", "type": "function", "groups": ["GeometryGroup"], - "description": "Tests whether a geometry is within another. Returns true if the geometry a is completely within geometry b.", - "arguments": [ {"arg":"geometry a","description":"a geometry"}, - {"arg":"geometry b","description":"a geometry"}], + "description": "Tests whether a geometry is within another. Returns true if the geometry1 is completely within geometry2.", + "arguments": [ {"arg":"geometry1","description":"a geometry"}, + {"arg":"geometry2","description":"a geometry"}], "examples": [ { "expression":"within( geom_from_wkt( 'POINT( 0.5 0.5)' ), geom_from_wkt( 'POLYGON((0 0, 0 1, 1 1, 1 0, 0 0))' ) )", "returns":"true"}, { "expression":"within( geom_from_wkt( 'POINT( 5 5 )' ), geom_from_wkt( 'POLYGON((0 0, 0 1, 1 1, 1 0, 0 0 ))' ) )", "returns":"false"} ] diff --git a/src/core/expression/qgsexpressionfunction.cpp b/src/core/expression/qgsexpressionfunction.cpp index 5b1aac641ac..3e9b40881cd 100644 --- a/src/core/expression/qgsexpressionfunction.cpp +++ b/src/core/expression/qgsexpressionfunction.cpp @@ -6114,26 +6114,26 @@ const QList &QgsExpression::Functions() << new QgsStaticExpressionFunction( QStringLiteral( "flip_coordinates" ), QgsExpressionFunction::ParameterList() << QgsExpressionFunction::Parameter( QStringLiteral( "geometry" ) ), fcnFlipCoordinates, QStringLiteral( "GeometryGroup" ) ) << new QgsStaticExpressionFunction( QStringLiteral( "relate" ), -1, fcnRelate, QStringLiteral( "GeometryGroup" ) ) << new QgsStaticExpressionFunction( QStringLiteral( "intersects_bbox" ), QgsExpressionFunction::ParameterList() << QgsExpressionFunction::Parameter( QStringLiteral( "geometry" ) ) << QgsExpressionFunction::Parameter( QStringLiteral( "geometry" ) ), fcnBbox, QStringLiteral( "GeometryGroup" ), QString(), false, QSet(), false, QStringList() << QStringLiteral( "bbox" ) ) - << new QgsStaticExpressionFunction( QStringLiteral( "disjoint" ), QgsExpressionFunction::ParameterList() << QgsExpressionFunction::Parameter( QStringLiteral( "geometry a" ) ) - << QgsExpressionFunction::Parameter( QStringLiteral( "geometry b" ) ), + << new QgsStaticExpressionFunction( QStringLiteral( "disjoint" ), QgsExpressionFunction::ParameterList() << QgsExpressionFunction::Parameter( QStringLiteral( "geometry1" ) ) + << QgsExpressionFunction::Parameter( QStringLiteral( "geometry2" ) ), fcnDisjoint, QStringLiteral( "GeometryGroup" ) ) - << new QgsStaticExpressionFunction( QStringLiteral( "intersects" ), QgsExpressionFunction::ParameterList() << QgsExpressionFunction::Parameter( QStringLiteral( "geometry a" ) ) - << QgsExpressionFunction::Parameter( QStringLiteral( "geometry b" ) ), + << new QgsStaticExpressionFunction( QStringLiteral( "intersects" ), QgsExpressionFunction::ParameterList() << QgsExpressionFunction::Parameter( QStringLiteral( "geometry1" ) ) + << QgsExpressionFunction::Parameter( QStringLiteral( "geometry2" ) ), fcnIntersects, QStringLiteral( "GeometryGroup" ) ) - << new QgsStaticExpressionFunction( QStringLiteral( "touches" ), QgsExpressionFunction::ParameterList() << QgsExpressionFunction::Parameter( QStringLiteral( "geometry a" ) ) - << QgsExpressionFunction::Parameter( QStringLiteral( "geometry b" ) ), + << new QgsStaticExpressionFunction( QStringLiteral( "touches" ), QgsExpressionFunction::ParameterList() << QgsExpressionFunction::Parameter( QStringLiteral( "geometry1" ) ) + << QgsExpressionFunction::Parameter( QStringLiteral( "geometry2" ) ), fcnTouches, QStringLiteral( "GeometryGroup" ) ) - << new QgsStaticExpressionFunction( QStringLiteral( "crosses" ), QgsExpressionFunction::ParameterList() << QgsExpressionFunction::Parameter( QStringLiteral( "geometry a" ) ) - << QgsExpressionFunction::Parameter( QStringLiteral( "geometry b" ) ), + << new QgsStaticExpressionFunction( QStringLiteral( "crosses" ), QgsExpressionFunction::ParameterList() << QgsExpressionFunction::Parameter( QStringLiteral( "geometry1" ) ) + << QgsExpressionFunction::Parameter( QStringLiteral( "geometry2" ) ), fcnCrosses, QStringLiteral( "GeometryGroup" ) ) - << new QgsStaticExpressionFunction( QStringLiteral( "contains" ), QgsExpressionFunction::ParameterList() << QgsExpressionFunction::Parameter( QStringLiteral( "geometry a" ) ) - << QgsExpressionFunction::Parameter( QStringLiteral( "geometry b" ) ), + << new QgsStaticExpressionFunction( QStringLiteral( "contains" ), QgsExpressionFunction::ParameterList() << QgsExpressionFunction::Parameter( QStringLiteral( "geometry1" ) ) + << QgsExpressionFunction::Parameter( QStringLiteral( "geometry2" ) ), fcnContains, QStringLiteral( "GeometryGroup" ) ) - << new QgsStaticExpressionFunction( QStringLiteral( "overlaps" ), QgsExpressionFunction::ParameterList() << QgsExpressionFunction::Parameter( QStringLiteral( "geometry a" ) ) - << QgsExpressionFunction::Parameter( QStringLiteral( "geometry b" ) ), + << new QgsStaticExpressionFunction( QStringLiteral( "overlaps" ), QgsExpressionFunction::ParameterList() << QgsExpressionFunction::Parameter( QStringLiteral( "geometry1" ) ) + << QgsExpressionFunction::Parameter( QStringLiteral( "geometry2" ) ), fcnOverlaps, QStringLiteral( "GeometryGroup" ) ) - << new QgsStaticExpressionFunction( QStringLiteral( "within" ), QgsExpressionFunction::ParameterList() << QgsExpressionFunction::Parameter( QStringLiteral( "geometry a" ) ) - << QgsExpressionFunction::Parameter( QStringLiteral( "geometry b" ) ), + << new QgsStaticExpressionFunction( QStringLiteral( "within" ), QgsExpressionFunction::ParameterList() << QgsExpressionFunction::Parameter( QStringLiteral( "geometry1" ) ) + << QgsExpressionFunction::Parameter( QStringLiteral( "geometry2" ) ), fcnWithin, QStringLiteral( "GeometryGroup" ) ) << new QgsStaticExpressionFunction( QStringLiteral( "translate" ), QgsExpressionFunction::ParameterList() << QgsExpressionFunction::Parameter( QStringLiteral( "geometry" ) ) << QgsExpressionFunction::Parameter( QStringLiteral( "dx" ) ) @@ -6217,17 +6217,17 @@ const QList &QgsExpression::Functions() << QgsExpressionFunction::Parameter( QStringLiteral( "geometry" ) ) << QgsExpressionFunction::Parameter( QStringLiteral( "segments" ), true, 36 ), fcnMinimalCircle, QStringLiteral( "GeometryGroup" ) ) - << new QgsStaticExpressionFunction( QStringLiteral( "difference" ), QgsExpressionFunction::ParameterList() << QgsExpressionFunction::Parameter( QStringLiteral( "geometry_a" ) ) - << QgsExpressionFunction::Parameter( QStringLiteral( "geometry_b" ) ), + << new QgsStaticExpressionFunction( QStringLiteral( "difference" ), QgsExpressionFunction::ParameterList() << QgsExpressionFunction::Parameter( QStringLiteral( "geometry1" ) ) + << QgsExpressionFunction::Parameter( QStringLiteral( "geometry2" ) ), fcnDifference, QStringLiteral( "GeometryGroup" ) ) - << new QgsStaticExpressionFunction( QStringLiteral( "distance" ), QgsExpressionFunction::ParameterList() << QgsExpressionFunction::Parameter( QStringLiteral( "geometry a" ) ) - << QgsExpressionFunction::Parameter( QStringLiteral( "geometry b" ) ), + << new QgsStaticExpressionFunction( QStringLiteral( "distance" ), QgsExpressionFunction::ParameterList() << QgsExpressionFunction::Parameter( QStringLiteral( "geometry1" ) ) + << QgsExpressionFunction::Parameter( QStringLiteral( "geometry2" ) ), fcnDistance, QStringLiteral( "GeometryGroup" ) ) << new QgsStaticExpressionFunction( QStringLiteral( "hausdorff_distance" ), QgsExpressionFunction::ParameterList() << QgsExpressionFunction::Parameter( QStringLiteral( "geometry1" ) ) << QgsExpressionFunction::Parameter( QStringLiteral( "geometry2" ) ) << QgsExpressionFunction::Parameter( QStringLiteral( "densify_fraction" ), true ), fcnHausdorffDistance, QStringLiteral( "GeometryGroup" ) ) - << new QgsStaticExpressionFunction( QStringLiteral( "intersection" ), QgsExpressionFunction::ParameterList() << QgsExpressionFunction::Parameter( QStringLiteral( "geometry_a" ) ) - << QgsExpressionFunction::Parameter( QStringLiteral( "geometry_b" ) ), + << new QgsStaticExpressionFunction( QStringLiteral( "intersection" ), QgsExpressionFunction::ParameterList() << QgsExpressionFunction::Parameter( QStringLiteral( "geometry1" ) ) + << QgsExpressionFunction::Parameter( QStringLiteral( "geometry2" ) ), fcnIntersection, QStringLiteral( "GeometryGroup" ) ) << new QgsStaticExpressionFunction( QStringLiteral( "sym_difference" ), QgsExpressionFunction::ParameterList() << QgsExpressionFunction::Parameter( QStringLiteral( "geometry1" ) ) << QgsExpressionFunction::Parameter( QStringLiteral( "geometry2" ) ), diff --git a/src/core/expression/qgsexpressionnodeimpl.cpp b/src/core/expression/qgsexpressionnodeimpl.cpp index 3711db6e6d7..3fbb6e6ef7a 100644 --- a/src/core/expression/qgsexpressionnodeimpl.cpp +++ b/src/core/expression/qgsexpressionnodeimpl.cpp @@ -91,6 +91,10 @@ QString QgsExpressionNode::NodeList::cleanNamedNodeName( const QString &name ) cleaned = QStringLiteral( "geometry" ); else if ( cleaned == QLatin1String( "val" ) ) cleaned = QStringLiteral( "value" ); + else if ( cleaned == QLatin1String( "geometry a" ) or cleaned == QLatin1String( "geometry_a" ) + cleaned = QStringLiteral( "geometry1" ); + else if ( cleaned == QLatin1String( "geometry b" ) or cleaned == QLatin1String( "geometry_b" ) + cleaned = QStringLiteral( "geometry2" ); return cleaned; }