1. 程式人生 > >在ArcGIS中如何刪除重複的點要素

在ArcGIS中如何刪除重複的點要素

完全通過field Calculate實現:

1.新建欄位[coordinate] ,型別設定為text,長度預設50,右擊該欄位,選擇field Calculate,點advanced,填入一下表達式:

' ----------------------------------------

' @ Tsonghua  090924

' ----------------------------------------

Dim Output As string

Dim pPoint As IPoint

Set pPoint = [Shape]

Output = pPoint.X & "," & pPoint.Y
複製程式碼


2.新建欄位[Dup],型別設定為 long integer,右鍵選field Calculate,在advanced的表示式框中填入:

' ----------------------------------------

' @ Tsonghua 090924

' ----------------------------------------

Static d As Object

Static i As Long

Dim iDup As Integer

Dim sField

' ----------------------------------------

'這裡填寫需要檢查的欄位名

sField = [coordinate]

' ----------------------------------------

If (i = 0) Then

Set d = CreateObject("Scripting.Dictionary")

End If

If (d.Exists(CStr(sField))) Then

iDup = 1

Else

d.Add CStr(sField), 1

iDup = 0

End If

i = i + 1
複製程式碼


3.這樣,只需要挑選出[Dup]欄位值為1的刪掉即可。