Answers:
通过QGIS 2.8中引入的功能编辑器,可以遍历字段名称并执行某种分析:
from qgis.core import *
from qgis.gui import *
@qgsfunction(args='auto', group='Custom')
def fields(feature, parent):
layer = qgis.utils.iface.activeLayer()
field_names = [field.name() for field in layer.fields()]
for name in field_names:
if "some_name" in name:
# Do something