I'm trying the user-defined expression functions for QGIS, as listed on Nathans blog: http://nathanw.net/2012/11/10/user-defined-expression-functions-for-qgis/
I always get the feature.geometry() as None, when running the user expression in the expression builder updating a text column? This happens for all geometries like point, lines and polygons. The data format is ESRI Shape. The code is in an userfunctions.py referenced from startup.py.
Simplified example:
from qgis.utils import qgsfunction
from qgis.core import QGis
@qgsfunction(0, "Python")
def test(values, feature, parent):
geom = feature.geometry()
if geom is None:
return 'geom is None'
return 'geom is NOT None'
My text column is updated with the text: 'geom is None'. Why can I not reference the geometry of a feature?