4

I'm using QGIS. I have an attribute table that lists different land classifications under the "Land Type" column (agricultural, industrial, etc.). I don't know what all the land types are and I would just like to find a list of them instead of scrolling down through thousands of entries. Is there a way to do this? The metadata table is wrong so I have no documentation to go from.

5 Answers 5

6

Try Vector => Analysis Tools => List unique values

3

Maybe another way:

  1. press Open Field Calculator button in the "Attributes Toolbar" to open the Field Calculator;

  2. find and select your Land Type column under Fields and Values node in the tree under Search textbox, then press All Unique button on the right.

3

To generate a comma separated list of all categories, you can use this expression:

concatenate_unique ( "landuse", concatenator:= ', ' )

You might want to add a condition like if ( "id" = 1, [expression], '') (substitute [expression] with the expreesion from above) to create the list only in one row and not in all of them to avoid excessive calculation of repeating values.

enter image description here

2

Probably not the most elegant solution, but you could also go to layer properties --> source --> query builder and click on All for your desired column.

enter image description here

1

You can use pyqgis, from: How to find unique values of an attribute with python in qgis?

vectorLayer = iface.activeLayer()
fname = 'kategori'
idx = vectorLayer.fields().indexOf(fname)
values = sorted(vectorLayer.uniqueValues(idx))
print('\n') #Just an empty line
for v in values:
    print(v)

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.