0

The situation I have a point layer ("Beobachtungen") and a single part polygon layer ("Single parts"). For both layers, every feature has a unique id.

As shown in the image, some points are within a polygon of "Single parts" and some are not.

The features of the point layer have a date field ("Datum" ; format: dd-MM-yyyy).

The task: I want to select all features from "Beobachtungen" that are within the same polygon AND share the same value for the field "Datum" . The value for the field "Datum" can be any possible date, not a specific one. Furthermore, I then want to keep only one of those features and delete the other duplicate(s). Which one to keep can be random.

enter image description here

9
  • If the result is a new layer (dataset) is that ok?
    – Aquamarine
    Commented Mar 18 at 19:16
  • Yeah I think that shouldnt be a problem.
    – Hannes
    Commented Mar 19 at 4:19
  • Do you need to retain point features that do not match the date on the enclosing polygon?
    – Aquamarine
    Commented Mar 19 at 13:51
  • definitely yes. and please be aware of the fact that it's not about a specific date of but any possible date that occurs at least two times inside the same (!) polygon. I searched very much for the answer but couldn't make it up to now. I guess I just need the right expression for "select by expression". It would be even enough to just select duplicates that are within the same polygon. I could do the delete-thing manually afterwards. your help is much appreciated!
    – Hannes
    Commented Mar 19 at 15:53
  • Another question! So you want to select all point features where the date of the point feature is the same as the date of the enclosing polygon and if there are more than one points with that date in the polygon, delete the duplicates. And leave all other points as they are - is that correct?
    – Aquamarine
    Commented Mar 19 at 20:11

1 Answer 1

1

This might work if my interpretation is correct:

  1. Run Join attributes by location creating layer Joined
  2. Select from the joined table those features that joined and run Delete Duplicates by attribute using the date field from the point layer and the key field from the polygon overlay layer with the selected features only option ON. This will create a layer that has a single point for any instance of date duplicates within a polygon and will also include any point features that don't have duplicates.
  3. Export features from Joined that have null in polygon key field to layer called Features not in overlay (they are located outside of all polygons)
  4. Run Merge Vector Layers - 2 layers as input to merge: a) the output from Delete Duplicates by Attribute and b) Features not in overlay

Input:

enter image description here

Result: enter image description here

2
  • cheers my friend! that worked like a charm! thank you very much. I learned a lot
    – Hannes
    Commented Mar 20 at 15:53
  • If it is something that you have to run frequently you could build a model to do it
    – Aquamarine
    Commented Mar 20 at 16:37

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.