QGIS/resources/function_help/json/apply_dash_pattern
Nyall Dawson 8ce33e1e08 [feature][expressions] Add new apply_dash_pattern function.
Applies a dash pattern to a geometry, returning a MultiLineStringi
geometry which is the input geometry stroked along each line/ring
with the specified pattern.

Rules can be set to control how the dash pattern is adjusted
at line endings. If a start rule or end rule is set, the adjustment
option defines whether both dash and gaps, or only dash or gap
sizes are adjusted to apply the rules.

An optional pattern offset can specify how far along the pattern
the result should start at.
(The offset is applied AFTER any start/end rules are applied.)

Sponsored by North Road, thanks to SLYR
2021-10-30 18:18:03 +11:00

19 lines
1.7 KiB
Plaintext

{
"name": "apply_dash_pattern",
"type": "function",
"groups": ["GeometryGroup"],
"description": "Applies a dash pattern to a geometry, returning a MultiLineString geometry which is the input geometry stroked along each line/ring with the specified pattern.",
"arguments": [
{"arg":"geometry","description":"a geometry"},
{"arg":"pattern","description":"dash pattern, as an array of numbers representing dash and gap lengths. Must contain an even number of elements."},
{"arg":"start_rule","optional": true, "default": "no_rule", "description":"optional rule for constraining the start of the pattern. Valid values are 'no_rule', 'full_dash', 'half_dash', 'full_gap', 'half_gap'."},
{"arg":"end_rule","optional": true, "default": "no_rule", "description":"optional rule for constraining the end of the pattern. Valid values are 'no_rule', 'full_dash', 'half_dash', 'full_gap', 'half_gap'."},
{"arg":"adjustment","optional": true, "default": "both", "description":"optional rule for specifying which part of patterns are adjusted to fit the desired pattern rules. Valid values are 'both', 'dash', 'gap'."},
{"arg":"pattern_offset","optional": true, "default": "0", "description":"Optional distance specifying a specific distance along the pattern to commence at."}
],
"examples": [
{ "expression":"geom_to_wkt(apply_dash_pattern(geom_from_wkt('LINESTRING(1 1, 10 1)'), array(3, 1)))", "returns":"MultiLineString ((1 1, 4 1),(5 1, 8 1),(9 1, 10 1, 10 1))"},
{ "expression":"geom_to_wkt(apply_dash_pattern(geom_from_wkt('LINESTRING(1 1, 10 1)'), array(3, 1), start_rule:='half_dash'))", "returns":"MultiLineString ((1 1, 2.5 1),(3.5 1, 6.5 1),(7.5 1, 10 1, 10 1))"}
]
}