2

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 (
            @layer,  
            array_first (
                overlay_nearest( @layer, $id)
            )
        ), 
        'name' ) , 
        $geometry, 
        '')

Process Duplicates Not Higlighted Single Duplicate Highlighted

1 Answer 1

3

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 ( 
 array_length( 
   array_filter( 
    overlay_nearest(
       @layer,"name",
       limit:=100, 
       max_distance:=10),
    @element= "name"))
    >1,
 $geometry, '')

overlay_nearest:

  • 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

3
  • 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.