9

Does anybody know how to display the geoemtry type of features in the attribute table?

enter image description here

1 Answer 1

12

Use field calculator with function geom_to_wkt which gives you WKT representation (geometry type, coordinates). Then add some string handling for gain only geometry type:

left(geom_to_wkt($geometry),strpos(geom_to_wkt($geometry),' ')-1)

strpos takes position of first space (' ') character in whole WKT string and print this number (-1 for removing extra space) of characters from the left. The result will be geometry type (Polygon, MultiPolygon etc.).

enter image description here

If you need to keep this attribute updated, check Create virtual field. How virtual fields work is described in Editing attribute values in QGIS documentation.

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.