10

I am trying to identify multipart features using QGIS version 1.8.0.

I've tried:

  1. look at the attributes table
  2. select a random feature and check in the canvas if there are multiple geometries selected
  3. repeat until found one or all features have been examined

What I would like to check is something like a Boolean value in the Layer properties.

0

2 Answers 2

7

I'm on QGIS 2.4; I'm not sure if this will work in 1.8!

Start an edit session on the layer and add a new field called multi - an integer, single-digit.

For the expression, enter:

CASE WHEN geomToWKT($geometry) LIKE '%MULTI%' THEN 1 ELSE 0 END

This will give you a 1 for each row when it's a multi-part line or polygon.

0
3

For QGIS 3.38 (and potentially some earlier versions), you can identify multipart geometries within a layer using the num_geometries() function directly in the Field Calculator. Here's how:

  1. Open the Field Calculator: Navigate to your layer in the Layers panel, right-click on it, and select "Open Field Calculator."

  2. Create a New Field:

    • Check the box labeled "Create a new field."
    • In the "Output field name" field, enter a descriptive name for the new field, for example, is_multipart or geometry_count.
    • Set the "Output field type" to "Integer" (if you want to store the count) or "Boolean" (if you just want to flag multipart features).
    • If you chose "Integer," set the "Output field length" to a suitable value like 10.
  3. Enter the Expression:

    • To get the number of geometries: In the "Expression" field, type or paste the following:
      num_geometries(@geometry)
      
    • To create a boolean flag (True for multipart, False otherwise): In the "Expression" field, type or paste:
      num_geometries(@geometry) > 1
      
  4. Click "OK": This will execute the calculation and populate the new field in your layer's attribute table.

Interpreting the Results:

  • If you used the integer expression, any feature where the value in the newly created field is greater than 1 has a multipart geometry.
  • If you used the boolean expression, any feature where the value in the newly created field is True has a multipart geometry.

You can then use this new field to select, filter, or style your layer to highlight the multipart features as needed.

2

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.