Last active
January 31, 2016 08:11
-
-
Save AlexArcPy/1a36e15b73b23b723018 to your computer and use it in GitHub Desktop.
Sample arcpy helper function
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
def select_distinct(input_fc,input_field): | |
'''returns a list of unique values in a field sorted''' | |
sql = (None, 'GROUP BY {0}'.format(input_field)) | |
cur = arcpy.da.SearchCursor(in_table=input_fc,field_names=["{0}".format(input_field)], | |
sql_clause=sql) | |
unique_values = [f[0] for f in cur] | |
return sorted(unique_values) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment