alex_functions.py
1 |
"""
|
---|---|
2 |
Template function file. Define new functions using @qgsfunction.
|
3 |
When using args="auto" you may define a new variable for each value for the function.
|
4 |
feature and parent must always be the last args.
|
5 |
To pass a any number of args into a function use args=-1 the first
|
6 |
variable will then be a list of values.
|
7 |
"""
|
8 |
|
9 |
from qgis.core import * |
10 |
from qgis.gui import * |
11 |
|
12 |
@qgsfunction(args="auto", group='Custom') |
13 |
def ellipsoid_area(geom, feature, parent): |
14 |
d = QgsDistanceArea() |
15 |
d.setEllipsoidalMode(False)
|
16 |
return d.measure(geom)
|
17 |
|
18 |
@qgsfunction(args="auto", group='Custom') |
19 |
def area(geometry, feature, parent): |
20 |
return geometry.area()
|
21 |
|
22 |
@qgsfunction(args="auto", group='Custom') |
23 |
def length_2(geometry, feature, parent): |
24 |
return geometry.length()
|
25 |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 |
|