2

I have a multipart polygon layer that resides on a PostGIS server. The layer is a parcel map, with each parcel having a single unique PIN. Most of the features are single parts, but some are two or more parts for various historical reasons. There are close to 40,000 features. If I check geometries for multipart geometries with only a single part, it returns all of my single part features. For small numbers of parcels I can use this tool to show these errors in the attribute table, invert the selection, and I have the parcels I am looking for. However, QGIS chokes when I try doing this with the full layer, and I really want to avoid having to do this in little bites when I'm sure there is a better way.

I want to select all the parcels that have more than one part. If I look at the Identify Results panel, the (derived) group shows the number of parts in that feature. This is the attribute I am looking for. How is this calculated, and how can I use this derived value as my criteria for a selection, or is there another way?

1
6

Go to the select by expression tool and use

num_geometries( $geometry) > 1

Then click on Select Features (lower right) and all the multi part geometries will be selected.

enter image description here

1
  • I did not think this would work as num_geometries() takes a collection of geometries as the argument. So, a feature with multiple parts is a collection of geometries? Not a single geometry object with? Your simple solution is correct, of course, and did exactly what I needed. Thank you. – celeryfarmer Oct 1 '20 at 17:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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