Instrução
Note: The procedure below is for ArcGIS 9.3.1 or earlier versions. Starting from ArcGIS 10.0, expressions in the Calculator are created using only a VBScript or standard Python format. For the equivalent process in ArcGIS Desktop 10, refer to How To: Convert a file with coordinates in degrees, minutes, and seconds to a feature class or shapefile using ArcMap 10.x
Follow the steps below.
Code: Dim sField Dim sDMS As String, sS As String, sSuf As String, sPre as string Dim sList Dim i As Integer, j As Integer Dim iDec As Integer, iNum As Integer Dim dD As Double, dM As Double, dS As Double, dDD As Double Dim bReplace As Boolean '============================= 'Change the source field name bellow sField = [dms] '============================= sDMS = sField If Len(Trim(sDMS)) = 0 Then dDD = 0 Else iDec = 0 iNum = 0 For i = 1 To Len(sDMS) sS = Mid(sDMS, i, 1) If Not IsNumeric(sS) Then If sS = "." Then If Not iDec = 0 Then bReplace = True Else bReplace = False End If iDec = iDec + 1 ElseIf sS = "-" Then sPre = "-" bReplace = True Else bReplace = True End If If bReplace Then If iNum > 0 Then Mid(sDMS, i, 1) = "," Else Mid(sDMS, i, 1) = " " End If End If Else iNum = iNum + 1 End If Next i sList = Split(sDMS, ",") Dim iLen As Integer If UBound(sList) = 0 Then sDMS = sList(0) iLen = Len(sDMS) If iLen >= 4 Then dS = CDbl(Mid(sDMS, iLen - 1, 2)) dM = CDbl(Mid(sDMS, iLen - 3, 2)) sDMS = Left(sDMS, (iLen - 4)) If (Len(sDMS) > 2) Then dD = CDbl(Right(sDMS, 3)) ElseIf (Len(sDMS) = 0) Then dD = 0# Else dD = CDbl(sDMS) End If Else dDD = 0 End If dDD = dD + dM / 60# + dS / 3600# Else j = 0 dD = 0# dM = 0# dS = 0# For i = 0 To UBound(sList) If IsNumeric(sList(i)) Then If j = 0 Then dD = CDbl(sList(i)) j = j + 1 ElseIf j = 1 Then dM = CDbl(sList(i)) j = j + 1 ElseIf j = 2 Then dS = CDbl(sList(i)) j = j + 1 End If End If Next i dDD = dD + dM / 60# + dS / 3600# End If If dDD < -180# Or dDD > 180# Then dDD = 0# End If If sPre = "-" Then dDD = dDD * -1# End If End If
Note: Change the name of the field in the script to that of the original DMS fields. Change the source field name to: sField = [Long]
Note: Defining the projection allows the data to display as an Even layer in the correct location in ArcMap.
Obtenha ajuda de especialistas do ArcGIS
Baixe o Aplicativo de Suporte da Esri