Skip to content
Permalink
Browse files

More updates of expression help

- Expose default values of args
- Fix args name or description
- Fix/add more examples (to show various possibilities of a function or so
that functions that relate have examples that relate)
  • Loading branch information
DelazJ authored and nyalldawson committed Aug 21, 2020
1 parent b743db7 commit ae8ea31a0f95e04fa5520f5bdef015b97d49e6de
@@ -3,6 +3,6 @@
"type": "function",
"groups": ["GeometryGroup"],
"description": "Returns the geometry of the current feature. Can be used for processing with other functions.",
"examples": [ { "expression":"geomToWKT( $geometry )", "returns":"POINT(6 50)"}
"examples": [ { "expression":"geom_to_wkt( $geometry )", "returns":"'POINT(6 50)'"}
]
}
@@ -4,6 +4,8 @@
"groups": ["GeometryGroup"],
"description":"Returns the closure of the combinatorial boundary of the geometry (ie the topological boundary of the geometry). For instance, a polygon geometry will have a boundary consisting of the linestrings for each ring in the polygon. Some geometry types do not have a defined boundary, e.g., points or geometry collections, and will return NULL.",
"arguments": [ {"arg":"geometry","description":"a geometry"} ],
"examples": [ { "expression":"geom_to_wkt(boundary(geom_from_wkt('Polygon((1 1, 0 0, -1 1, 1 1))')))", "returns":"'LineString(1 1,0 0,-1 1,1 1)'"}]
"examples": [ { "expression":"geom_to_wkt(boundary(geom_from_wkt('Polygon((1 1, 0 0, -1 1, 1 1))')))", "returns":"'LineString(1 1,0 0,-1 1,1 1)'"},
{ "expression":"geom_to_wkt(boundary(geom_from_wkt('LineString(1 1,0 0,-1 1)')))", "returns":"'MultiPoint ((1 1),(-1 1))'"}
]
}

@@ -4,6 +4,8 @@
"groups": ["GeometryGroup"],
"description":"Returns a geometry which represents the bounding box of an input geometry. Calculations are in the Spatial Reference System of this geometry.",
"arguments": [ {"arg":"geometry","description":"a geometry"} ],
"examples": [ { "expression":"bounds($geometry)", "returns":"bounding box of the current feature's geometry"}]
"examples": [ { "expression":"bounds($geometry)", "returns":"bounding box of the current feature's geometry"},
{ "expression":"geom_to_wkt(bounds(geom_from_wkt('Polygon((1 1, 0 0, -1 1, 1 1))')))", "returns":"'Polygon ((-1 0, 1 0, 1 1, -1 1, -1 0))'"}
]
}

@@ -4,6 +4,8 @@
"groups": ["GeometryGroup"],
"description": "Returns the height of the bounding box of a geometry. Calculations are in the Spatial Reference System of this geometry.",
"arguments": [ {"arg":"geometry","description":"a geometry"}],
"examples": [ { "expression":"bounds_height($geometry)", "returns":"height of bounding box of the current feature's geometry"}]
"examples": [ { "expression":"bounds_height($geometry)", "returns":"height of bounding box of the current feature's geometry"},
{ "expression":"bounds_height(geom_from_wkt('Polygon((1 1, 0 0, -1 1, 1 1))'))", "returns":"1"}
]
}

@@ -4,6 +4,8 @@
"groups": ["GeometryGroup"],
"description": "Returns the width of the bounding box of a geometry. Calculations are in the Spatial Reference System of this geometry.",
"arguments": [ {"arg":"geometry","description":"a geometry"}],
"examples": [ { "expression":"bounds_width($geometry)", "returns":"width of bounding box of the current feature's geometry"}]
"examples": [ { "expression":"bounds_width($geometry)", "returns":"width of bounding box of the current feature's geometry"},
{ "expression":"bounds_width(geom_from_wkt('Polygon((1 1, 0 0, -1 1, 1 1))'))", "returns":"2"}
]
}

@@ -10,12 +10,12 @@
],
"examples": [
{
"expression":"extrude(geom_from_wkt('LineString(1 2, 3 2, 4 3)'), 1, 2)",
"returns":"Polygon ((1 2, 3 2, 4 3, 5 5, 4 4, 2 4, 1 2))"
"expression":"geom_to_wkt(extrude(geom_from_wkt('LineString(1 2, 3 2, 4 3)'), 1, 2))",
"returns":"'Polygon ((1 2, 3 2, 4 3, 5 5, 4 4, 2 4, 1 2))'"
},
{
"expression":"extrude(geom_from_wkt('MultiLineString((1 2, 3 2), (4 3, 8 3)'), 1, 2)",
"returns":"MultiPolygon (((1 2, 3 2, 4 4, 2 4, 1 2)),((4 3, 8 3, 9 5, 5 5, 4 3)))"
"expression":"geom_to_wkt(extrude(geom_from_wkt('MultiLineString((1 2, 3 2), (4 3, 8 3))'), 1, 2))",
"returns":"'MultiPolygon (((1 2, 3 2, 4 4, 2 4, 1 2)),((4 3, 8 3, 9 5, 5 5, 4 3)))'"
}
]
}
@@ -4,7 +4,9 @@
"groups": ["GeometryGroup"],
"description": "Returns the Well-Known Text (WKT) representation of the geometry without SRID metadata.",
"arguments": [ {"arg":"geometry","description":"a geometry"},
{"arg":"precision","description":"numeric precision", "optional":true}],
"examples": [ { "expression":"geom_to_wkt( $geometry )", "returns":"POINT(6 50)"}
]
{"arg":"precision","description":"numeric precision", "optional":true, "default":"8"}],
"examples": [ { "expression":"geom_to_wkt( make_point(6, 50) )", "returns":"'POINT(6 50)'"},
{ "expression":"geom_to_wkt(centroid(geom_from_wkt('Polygon((1 1, 0 0, -1 1, 1 1))')))", "returns":"POINT(0 0.66666667)"},
{ "expression":"geom_to_wkt(centroid(geom_from_wkt('Polygon((1 1, 0 0, -1 1, 1 1))')), 2)", "returns":"POINT(0 0.67)"}
]
}
@@ -5,7 +5,7 @@
"description": "Returns the minimal enclosing circle of a geometry. It represents the minimum circle that encloses all geometries within the set.",
"arguments": [
{"arg":"geometry","description":"a geometry"},
{"arg":"segment", "optional": true, "default": "36", "description": "optional argument for polygon segmentation. By default this value is 36"}],
{"arg":"segments", "optional": true, "default": "36", "description": "optional argument for polygon segmentation. By default this value is 36"}],
"examples": [
{ "expression":"geom_to_wkt( minimal_circle( geom_from_wkt( 'LINESTRING(0 5, 0 -5, 2 1)' ), 4 ) )", "returns":"Polygon ((0 5, 5 -0, -0 -5, -5 0, 0 5))"},
{ "expression":"geom_to_wkt( minimal_circle( geom_from_wkt( 'MULTIPOINT(1 2, 3 4, 3 2)' ), 4 ) )", "returns":"Polygon ((3 4, 3 2, 1 2, 1 4, 3 4))"}
@@ -4,10 +4,10 @@
"groups": ["GeometryGroup"],
"description":"Smooths a geometry by adding extra nodes which round off corners in the geometry. If input geometries contain Z or M values, these will also be smoothed and the output geometry will retain the same dimensionality as the input geometry.",
"arguments": [ {"arg":"geometry","description":"a geometry"},
{"arg":"iterations", "optional":true,"description":"number of smoothing iterations to apply. Larger numbers result in smoother but more complex geometries."},
{"arg":"offset", "optional":true,"description":"value between 0 and 0.5 which controls how tightly the smoothed geometry follow the original geometry. Smaller values result in a tighter smoothing, larger values result in looser smoothing."},
{"arg":"min_length", "optional":true,"description":"minimum length of segments to apply smoothing to. This parameter can be used to avoid placing excessive additional nodes in shorter segments of the geometry."},
{"arg":"max_angle", "optional":true,"description":"maximum angle at node for smoothing to be applied (0-180). By lowering the maximum angle intentionally sharp corners in the geometry can be preserved. For instance, a value of 80 degrees will retain right angles in the geometry."} ],
{"arg":"iterations", "optional":true, "default":"1", "description":"number of smoothing iterations to apply. Larger numbers result in smoother but more complex geometries."},
{"arg":"offset", "optional":true, "default":"0.25", "description":"value between 0 and 0.5 which controls how tightly the smoothed geometry follow the original geometry. Smaller values result in a tighter smoothing, larger values result in looser smoothing."},
{"arg":"min_length", "optional":true, "default":"-1", "description":"minimum length of segments to apply smoothing to. This parameter can be used to avoid placing excessive additional nodes in shorter segments of the geometry."},
{"arg":"max_angle", "optional":true, "default":"180", "description":"maximum angle at node for smoothing to be applied (0-180). By lowering the maximum angle intentionally sharp corners in the geometry can be preserved. For instance, a value of 80 degrees will retain right angles in the geometry."} ],
"examples": [ { "expression":"geom_to_wkt(smooth(geometry:=geom_from_wkt('LineString(0 0, 5 0, 5 5)'),iterations:=1,offset:=0.2,min_length:=-1,max_angle:=180))", "returns":"'LineString (0 0, 4 0, 5 1, 5 5)'"}]
}

@@ -7,10 +7,11 @@
{"arg":"coordinate","description":"A latitude or longitude value."},
{"arg":"axis","description":"The axis of the coordinate. Either 'x' or 'y'."},
{"arg":"precision", "description":"Number of decimals."},
{"arg":"formatting", "optional": true, "default":"", "description":"Designates the formatting type. Acceptable values are NULL, 'aligned' or 'suffix'."}
{"arg":"formatting", "optional": true, "default":"", "description":"Designates the formatting type. Acceptable values are NULL (default), 'aligned' or 'suffix'."}
],
"examples": [
{ "expression":"to_dm(6.3545681, 'x', 3)", "returns":"6°21.274′"},
{ "expression":"to_dm(6.3545681, 'y', 4, 'suffix')", "returns":"6°21.2741′N"}
"examples": [
{ "expression":"to_dm(6.1545681, 'x', 3)", "returns":"6°9.274′"},
{ "expression":"to_dm(6.1545681, 'y', 4, 'aligned')", "returns":"6°09.2741′N"},
{ "expression":"to_dm(6.1545681, 'y', 4, 'suffix')", "returns":"6°9.2741′N"}
]
}
@@ -7,10 +7,11 @@
{"arg":"coordinate","description":"A latitude or longitude value."},
{"arg":"axis","description":"The axis of the coordinate. Either 'x' or 'y'."},
{"arg":"precision", "description":"Number of decimals."},
{"arg":"formatting", "optional": true, "default":"", "description":"Designates the formatting type. Acceptable values are NULL, 'aligned' or 'suffix'."}
{"arg":"formatting", "optional": true, "default":"", "description":"Designates the formatting type. Acceptable values are NULL (default), 'aligned' or 'suffix'."}
],
"examples": [
{ "expression":"to_dms(6.3545681, 'x', 3)", "returns":"6°21′16.445″"},
{ "expression":"to_dms(6.3545681, 'y', 4, 'suffix')", "returns":"6°21′16.4452″N"}
"examples": [
{ "expression":"to_dms(6.1545681, 'x', 3)", "returns":"6°9′16.445″"},
{ "expression":"to_dms(6.1545681, 'y', 4, 'aligned')", "returns":"6°09′16.4452″N"},
{ "expression":"to_dms(6.1545681, 'y', 4, 'suffix')", "returns":"6°9′16.4452″N"}
]
}

0 comments on commit ae8ea31

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