|
2 | 2 | "name": "maptip",
|
3 | 3 | "type": "function",
|
4 | 4 | "groups": ["Record and Attributes"],
|
5 |
| - "description": "Returns the maptip for a given feature in a layer. If called with no parameters, it evaluates the current feature. The maptip is evaluated by default.", |
6 |
| - "arguments": [ |
| 5 | + "description": "Returns the maptip for a given feature in a layer. The expression is evaluated by default. Can be used with zero, one or more arguments, see below for details.", |
| 6 | + "variants": [ |
7 | 7 | {
|
8 |
| - "arg": "feature", |
9 |
| - "optional": true, |
10 |
| - "default": "current feature", |
11 |
| - "description": "The feature which should be evaluated." |
| 8 | + "variant": "No parameters", |
| 9 | + "variant_description": "If called with no parameters, the function will evaluate the maptip of the current feature in the current layer.", |
| 10 | + "arguments": [], |
| 11 | + "examples": [ { "expression": "maptip()", "returns" : "The maptip of the current feature in the current layer." } ] |
12 | 12 | },
|
13 | 13 | {
|
14 |
| - "arg": "layer", |
15 |
| - "optional": true, |
16 |
| - "default": "current layer", |
17 |
| - "description": "The layer (or its id or name)." |
| 14 | + "variant": "One 'feature' parameter", |
| 15 | + "variant_description": "If called with a 'feature' parameter only, the function will evaluate the specified feature from the current layer.", |
| 16 | + "arguments": [ { "arg": "feature", "description": "The feature which should be evaluated." } ], |
| 17 | + "examples": [ { "expression": "maptip(@atlas_feature)", "returns": "The maptip of the current atlas feature." } ] |
18 | 18 | },
|
19 | 19 | {
|
20 |
| - "arg": "evaluate", |
21 |
| - "description": "If the expression must be evaluated. If false, the expression will be returned as a string literal only (which could potentially be later evaluated using the 'eval_template' function).", |
22 |
| - "optional": true, |
23 |
| - "default": "true" |
24 |
| - } |
25 |
| - ], |
26 |
| - "examples": [ |
27 |
| - { |
28 |
| - "expression": "maptip()", |
29 |
| - "returns": "The maptip of the current feature." |
30 |
| - }, |
31 |
| - { |
32 |
| - "expression": "maptip(get_feature('streets', 1), 'streets')", |
33 |
| - "returns": "The maptip of the feature with the ID 1 on the layer 'streets'." |
34 |
| - }, |
35 |
| - { |
36 |
| - "expression": "maptip('a_layer_id', $currentfeature, 'False')", |
37 |
| - "returns": "The maptip of the given feature not evaluated." |
| 20 | + "variant" : "Layer and feature parameters", |
| 21 | + "variant_description": "If the function is called with both a layer and a feature, it will evaluate the specified feature from the specified layer.", |
| 22 | + "arguments": [ |
| 23 | + { "arg": "layer", "description": "The layer (or its ID or name)" }, |
| 24 | + { "arg": "feature", "description": "The feature which should be evaluated." }, |
| 25 | + { "arg": "evaluate", "description": "If the expression must be evaluated. If false, the expression will be returned as a string literal only (which could potentially be later evaluated using the 'eval_template' function).", "optional": true, "default": "true" } |
| 26 | + ], |
| 27 | + "examples": [ |
| 28 | + { "expression": "maptip('streets', get_feature_by_id('streets', 1))", |
| 29 | + "returns": "The maptip of the feature with the ID 1 on the layer 'streets'." |
| 30 | + }, |
| 31 | + { "expression": "maptip('a_layer_id', $currentfeature, 'False')", |
| 32 | + "returns": "The maptip of the given feature not evaluated." |
| 33 | + } |
| 34 | + ] |
38 | 35 | }
|
39 | 36 | ]
|
40 | 37 | }
|
0 commit comments