HOW TO
The following script takes a point shapefile that has duplicate point locations and creates a new shapefile without duplicate points.
Code: '--- Remove_Duplicate_Points.ave ' '-- This script takes a point shapefile with duplicate point locations '-- and creates a new shapefile without the duplicate points theview = av.getactivedoc theTheme = theView.getactivethemes.get(0) theFTab = theTheme.GetFTab theshpfld = theFTab.FindField("Shape") thefieldlist = theftab.getfields theidfield = msgbox.listasstring(thefieldlist,"This field"+ "must contain unique ID values. It can be used"+ "to join attributes from your active theme to your new"+ "theme.","Select a Field") if (theidfield = nil) then return nil end defaultName = av.getproject.getworkdir.MakeTmp("inter","shp") newfile = FileDialog.Put(defaultName,"*.shp","New POINT Theme") if (newfile = nil) then return nil end thenewftab = ftab.makenew(newfile,point) thenewtheme = ftheme.make(thenewftab) thenewtheme.setvisible(true) thenewtheme.setactive(true) theview.addtheme(thenewtheme) newfldShape = thenewFTab.FindField("Shape") thenewidfield = field.make(theidfield.asstring,#FIELD_DECIMAL, 8, 0) thenewftab.addfields({thenewidfield}) thenewFTab.seteditable(true) theview.invalidate for each rec in theftab thepoint = theftab.returnvalue(theshpfld, rec) theid = theftab.returnvalue(theidfield, rec) thenewftab.selectbypoint(thepoint, 0.00000001, #VTAB_SELTYPE_NEW) if (thenewftab.getselection.count = 0) then newrec = thenewftab.addrecord thenewFTab.SetValue(newfldShape,newrec,thepoint) thenewftab.setvalue(thenewidfield, newrec, theid) end end thenewftab.seteditable(false) '--- End of Script
Get help from ArcGIS experts
Download the Esri Support App