Thursday, 8 November 2018

arcgis desktop - Select distinct values from a single column of an attribute table (or layer)


Is there a way to select distinct values from a column in ArcMap? I have the data in both GDB and SHP formats. I have searched for ways to select using SQL, QueryLayers, ModelBuilder and individual toolboxes and it appears as all selection options always SELECT * FROM tableName WHERE ...



In SQL I would write SELECT DISTINCT columnName FROM tableName.



Answer



Or you can run the ArcToolBox tool Frequency (Analysis Tools>>Statistics>>Frequency) which will output a table with unique values and a count of how many time they appear.


Or you could write python script that gets a SearchCursor on a field then build a list of all values of the form


if value not in myList:
myList.append(value)

No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...