3

I have duplicated features in point layer (Land Marks) but these duplicate has 2 cases :

  1. they might be not all have their center above each other (some have it at center , some is a bit far but its the same point)
  2. they might have little different in name like a letter different or a character like dash is in one of the names

like for example a branch for Pizza Hut at Main street is represented by two points that are some distance apart , when its suppose to be at one location and same point . (and it might be there is another point of different land mark near it too )

or like "Zeid Haritha Shrine" and the 2nd one "Zeid Haritha / Shrine" or "Zeid Haretha Shrine"

is there any way i can find them automatically in any of these cases instead of going by all the points (its large number of points)

i use Arcgis but if there is a way in another program i can do it too

2 Answers 2

1

Use tool Delete Identical:

Deletes records in a feature class or table which have identical values in a list of fields. If the field Shape is selected, feature geometries are compared.

With Shape field selected and a specified xy_tolerance. This will not work if you have a "Zeid Haritha Shrine" landmark at the same spot as a "Pizza Hut" sign and want to keep both.

In that case you can use Python code and the difflib.sequencematcher to find and delete points at the same spot with almost the same name. Adjust the distance and match limit. The script will create a copy of your input fc so your input will not be modified. The code can be executed in the Python window.

import arcpy,math
from difflib import SequenceMatcher
arcpy.env.overwriteOutput=1

searchdistance=100 #Points within this distance is considered to be duplicates
matchlimit=0.90 #Name match limit

namefield='Name' #Change to match your data
input_fc=r'C:\Default.gdb\Identicals' #Change to match your data
output_fc=r'C:\Default.gdb\NoIdencticals' #Change to match your data

arcpy.CopyFeatures_management(in_features=input_fc, out_feature_class=output_fc)

with arcpy.da.SearchCursor(output_fc,['OID@','SHAPE@X','SHAPE@Y',namefield]) as cursor1:
    for row1 in cursor1:
        with arcpy.da.UpdateCursor(output_fc,['OID@','SHAPE@X','SHAPE@Y',namefield]) as cursor2:
            for row2 in cursor2:
                if row1[0]!=row2[0]:
                    distance=math.sqrt(((row2[1]-row1[1])**2+(row2[2]-row1[2])**2))
                    namematch=SequenceMatcher(a=row1[3], b=row2[3]).ratio()
                    if distance<=searchdistance and namematch>=matchlimit:
                        cursor2.deleteRow()

enter image description here

0

I'd start from the name similarities and only then check range. Don't know about ArcGIS, but QGIS field calculator supports Levenshtein and Hamming distance functions, which tell you how many characters would need to change for one string to become another.

The algorithm would look something like:

  1. For each point, take a buffer (eg. 100m).
  2. For each point pair within the buffer, calculate one of the string distances.
  3. If the distance is low, eg. < 3, consider the two points duplicates and make a note somewhere or delete one.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.