Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Various improvements to expression
- Add/fix details to description and examples to illustrate
- indicate string for geom_to_wkt
  • Loading branch information
DelazJ authored and nyalldawson committed Aug 31, 2020
1 parent 13573d2 commit 97247ef
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 14 deletions.
2 changes: 1 addition & 1 deletion resources/function_help/json/concatenate
Expand Up @@ -7,7 +7,7 @@
{"arg":"expression", "description":"sub expression of field to aggregate"},
{"arg":"group_by", "optional":true, "description":"optional expression to use to group aggregate calculations"},
{"arg":"filter", "optional":true, "description":"optional expression to use to filter features used to calculate aggregate"},
{"arg":"concatenator", "optional":true, "default":"''", "description":"optional string to use to join values"},
{"arg":"concatenator", "optional":true, "description":"optional string to use to join values. Empty by default."},
{"arg":"order_by", "optional":true, "description":"optional expression to use to order features used to calculate aggregate. By default, the features will be returned in an unspecified order."}
],
"examples": [
Expand Down
4 changes: 2 additions & 2 deletions resources/function_help/json/concatenate_unique
Expand Up @@ -7,10 +7,10 @@
{"arg":"expression", "description":"sub expression of field to aggregate"},
{"arg":"group_by", "optional":true, "description":"optional expression to use to group aggregate calculations"},
{"arg":"filter", "optional":true, "description":"optional expression to use to filter features used to calculate aggregate"},
{"arg":"concatenator", "optional":true, "default":"''", "description":"optional string to use to join values"},
{"arg":"concatenator", "optional":true, "description":"optional string to use to join values. Empty by default."},
{"arg":"order_by", "optional":true, "description":"optional expression to use to order features used to calculate aggregate. By default, the features will be returned in an unspecified order."}
],
"examples": [
{ "expression":"concatenate(\"town_name\",group_by:=\"state\",concatenator:=',')", "returns":"comma separated list of unique town_names, grouped by state field"}
{ "expression":"concatenate_unique(\"town_name\",group_by:=\"state\",concatenator:=',')", "returns":"comma separated list of unique town_names, grouped by state field"}
]
}
5 changes: 3 additions & 2 deletions resources/function_help/json/extend
Expand Up @@ -2,10 +2,11 @@
"name": "extend",
"type": "function",
"groups": ["GeometryGroup"],
"description": "Extends the start and end of a linestring geometry by a specified amount. Lines are extended using the bearing of the first and last segment in the line. Distances are in the Spatial Reference System of this geometry.",
"description": "Extends the start and end of a linestring geometry by a specified amount. Lines are extended using the bearing of the first and last segment in the line. For a multilinestring, all the parts are extended. Distances are in the Spatial Reference System of this geometry.",
"arguments": [ {"arg":"geometry","description":"a (multi)linestring geometry"},
{"arg":"start_distance","description":"distance to extend the start of the line"},
{"arg":"end_distance","description":"distance to extend the end of the line."}],
"examples": [ { "expression":"geom_to_wkt(extend(geom_from_wkt('LineString(0 0, 1 0, 1 1)'),1,2))", "returns":"'LineString (-1 0, 1 0, 1 3)'"}]
"examples": [ { "expression":"geom_to_wkt(extend(geom_from_wkt('LineString(0 0, 1 0, 1 1)'),1,2))", "returns":"'LineString (-1 0, 1 0, 1 3)'"},
{ "expression":"geom_to_wkt(extend(geom_from_wkt('multiLineString((0 0, 1 0, 1 1), (2 2, 0 2, 0 5))'),1,2))", "returns":"'MultiLineString ((-1 0, 1 0, 1 3),(3 2, 0 2, 0 7))'"}]
}

4 changes: 3 additions & 1 deletion resources/function_help/json/intersection
Expand Up @@ -5,5 +5,7 @@
"description": "Returns a geometry that represents the shared portion of two geometries.",
"arguments": [ {"arg":"geometry1","description":"a geometry"},
{"arg":"geometry2","description":"a geometry"}],
"examples": [ { "expression":"geom_to_wkt( intersection( geom_from_wkt( 'LINESTRING(3 3, 4 4, 5 5)' ), geom_from_wkt( 'LINESTRING(3 3, 4 4)' ) ) )", "returns":"'LINESTRING(3 3, 4 4)'"} ]
"examples": [ { "expression":"geom_to_wkt( intersection( geom_from_wkt( 'LINESTRING(3 3, 4 4, 5 5)' ), geom_from_wkt( 'LINESTRING(3 3, 4 4)' ) ) )", "returns":"'LINESTRING(3 3, 4 4)'"},
{ "expression":"geom_to_wkt( intersection( geom_from_wkt( 'LINESTRING(3 3, 4 4, 5 5)' ), geom_from_wkt( 'MULTIPOINT(3.5 3.5, 4 5)' ) ) )", "returns":"'POINT(3.5 3.5)'"}
]
}
8 changes: 4 additions & 4 deletions resources/function_help/json/order_parts
Expand Up @@ -10,12 +10,12 @@
],
"examples": [
{
"expression":"order_parts(geom_from_wkt('MultiPolygon (((1 1, 5 1, 5 5, 1 5, 1 1)),((1 1, 9 1, 9 9, 1 9, 1 1)))'), 'area($geometry)', False)",
"returns":"MultiPolygon (((1 1, 9 1, 9 9, 1 9, 1 1)),((1 1, 5 1, 5 5, 1 5, 1 1)))"
"expression":"geom_to_wkt(order_parts(geom_from_wkt('MultiPolygon (((1 1, 5 1, 5 5, 1 5, 1 1)),((1 1, 9 1, 9 9, 1 9, 1 1)))'), 'area($geometry)', False))",
"returns":"'MultiPolygon (((1 1, 9 1, 9 9, 1 9, 1 1)),((1 1, 5 1, 5 5, 1 5, 1 1)))'"
},
{
"expression":"order_parts(geom_from_wkt('LineString(1 2, 3 2, 4 3)'), '1', True)",
"returns":"LineString(1 2, 3 2, 4 3)"
"expression":"geom_to_wkt(order_parts(geom_from_wkt('LineString(1 2, 3 2, 4 3)'), '1', True))",
"returns":"'LineString(1 2, 3 2, 4 3)'"
}
]
}
2 changes: 1 addition & 1 deletion resources/function_help/json/oriented_bbox
Expand Up @@ -4,6 +4,6 @@
"groups": ["GeometryGroup"],
"description":"Returns a geometry which represents the minimal oriented bounding box of an input geometry.",
"arguments": [ {"arg":"geometry","description":"a geometry"} ],
"examples": [ { "expression":"geom_to_wkt( oriented_bbox( geom_from_wkt( 'MULTIPOINT(1 2, 3 4, 3 2)' ) ) )", "returns":"Polygon ((1 4, 1 2, 3 2, 3 4, 1 4))"}]
"examples": [ { "expression":"geom_to_wkt( oriented_bbox( geom_from_wkt( 'MULTIPOINT(1 2, 3 4, 3 2)' ) ) )", "returns":"'Polygon ((3 2, 3 4, 1 4, 1 2, 3 2))'"}]
}

2 changes: 1 addition & 1 deletion resources/function_help/json/pole_of_inaccessibility
Expand Up @@ -5,5 +5,5 @@
"description": "Calculates the approximate pole of inaccessibility for a surface, which is the most distant internal point from the boundary of the surface. This function uses the 'polylabel' algorithm (Vladimir Agafonkin, 2016), which is an iterative approach guaranteed to find the true pole of inaccessibility within a specified tolerance. More precise tolerances require more iterations and will take longer to calculate.",
"arguments": [ {"arg":"geometry","description":"a geometry"},
{"arg":"tolerance","description":"maximum distance between the returned point and the true pole location"}],
"examples": [ { "expression":"geom_to_wkt(pole_of_inaccessibility( geom_from_wkt('POLYGON((0 1,0 9,3 10,3 3, 10 3, 10 1, 0 1))'), 0.1))", "returns":"Point(1.55, 1.55)"}]
"examples": [ { "expression":"geom_to_wkt(pole_of_inaccessibility( geom_from_wkt('POLYGON((0 1, 0 9, 3 10, 3 3, 10 3, 10 1, 0 1))'), 0.1))'", "returns":"'Point(1.546875 2.546875)'"}]
}
2 changes: 1 addition & 1 deletion resources/function_help/json/transform
Expand Up @@ -7,6 +7,6 @@
{"arg":"source_auth_id","description":"the source auth CRS ID"},
{"arg":"dest_auth_id","description":"the destination auth CRS ID"}
],
"examples": [ { "expression":"geom_to_wkt( transform( $geometry, 'EPSG:2154', 'EPSG:4326' ) )", "returns":"POINT(0 51)"}
"examples": [ { "expression":"geom_to_wkt( transform( make_point(488995.53240249, 7104473.38600835), 'EPSG:2154', 'EPSG:4326' ) )", "returns":"'POINT(0 51)'"}
]
}
2 changes: 1 addition & 1 deletion resources/function_help/json/union
Expand Up @@ -5,5 +5,5 @@
"description": "Returns a geometry that represents the point set union of the geometries.",
"arguments": [ {"arg":"geometry1","description":"a geometry"},
{"arg":"geometry2","description":"a geometry"}],
"examples": [ { "expression":"geom_to_wkt( union( geom_from_wkt( 'POINT(4 4)' ), geom_from_wkt( 'POINT(5 5)' ) ) )", "returns":"MULTIPOINT(4 4, 5 5)"} ]
"examples": [ { "expression":"geom_to_wkt( union( make_point(4, 4), make_point(5, 5) ) )", "returns":"'MULTIPOINT(4 4, 5 5)'"} ]
}

0 comments on commit 97247ef

Please sign in to comment.