Last active
October 22, 2015 22:59
-
-
Save NathanW2/547db77ed63f3c64a3a4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from qgis.core import * | |
from qgis.gui import * | |
@qgsfunction(args=-1, group='Custom') | |
def max_name(fields, feature, parent): | |
realindex = [feature.fieldNameIndex(field) for field in fields] | |
values = [feature[field] for field in fields] | |
index = values.index(max(values)) | |
index = realindex[index] | |
return feature.fields()[index].name() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Usage