3

In QGIS I created a one-to-many relation between a polygon layer and a non-geometry table, so it has multiple lines for each feature in the polygon layer. My question now is how can I count how many rows were related?

For example, let's suppose the table has 44.000 rows, and I have 26.000 polygon features (each with its own id). If it were a one-to-one relation I know it would've been 26.000 relations, but since it's a one-to-many a polygon can have 2 or more rows related with it. How could I know how many rows were related then?

3

You can use "Statistics by Categories" on the related table. I use plot_uuid as Field(s) with categories:

enter image description here

1
  • This is nice, but it does not solve my problem considering (for what I tested) that it only counts the same occurrences of a value in one field in a layer. But it doesn't acknowledge the relation situation, in a way that I can't know how many hows were related. For example, in my non_geometry layer when I used the Statistics by Categories the function counted all the fields values that I used to create the relation despite they were related or not, still letting me in the dark with how many of them were in fact present in the polygon layer.
    – Felippe M.
    Jun 25 at 12:21

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.