Actually I am using Geometry Generator and a small script for displaying duplicate values in the data. But some duplications are not highlighted. Don't know why its happening. can any one suggest any solution for that.

Script using:

if ( 
    "name" =
    attribute (
        get_feature_by_id (
            array_first (
                overlay_nearest( @layer, $id)
        'name' ) , 

Process Duplicates Not Higlighted Single Duplicate Highlighted

1 Answer 1


It is not working as expected because one of the duplicate is closest to a point having a different name

Instead, it is possible to get multiple nearby points - with a max distance - and to count if there are duplicated names.

if ( 
    @element= "name"))
 $geometry, '')


  • max_distance restrict the search radius (in map units).
  • limit: how many points to consider (-1 would have been ideal but I couldn't make it work. Use a large enough value to go over the "nearby but with a different name" points).
  • "name" return an array of found names.

array_filter: keep only names being the same as the current feature name (including itself!)

array_length .. >1: since the current feature name is returned, look for duplicates (or more)

enter image description here

  • I use the script which you have used but duplicate data is not get highlighted as you shown in your screenshot
    – Bruno B
    Jun 13, 2021 at 3:21
  • @BrunoB have you adjusted the max_distance value to a meaningful one? Remember it is in map-units (meters, degree etc)
    – JGH
    Jun 13, 2021 at 11:41
  • Yes I did it as you said
    – Bruno B
    Jun 13, 2021 at 12:14

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.