المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : لماذا خيار field calculator غير مفعل عندما اضيف جدول اكسيل



عبادة مالك
10-27-2010, 09:20 PM
السلام عليكم
-قمت باضافة ملف اكسيل الى واجهة arcmap بغرض تطبيق بعض الامور البرمجية ..واتبعت الخطوت الصحيحة ...ولكن كيف لي ان افعل خيار field calculator وخيار add field ..حيث كما في الصورة الخيارات غير مفعلة ....وحيث انني اتبعت الخطوات الصحيحة كما هو مشروح في موقع الشركة ...ولم افلح في ذلك
http://www9.0zz0.com/2010/10/27/18/537064665.jpg (http://www.0zz0.com)

ماهر عبدالكريم
10-27-2010, 09:34 PM
عزيزي عبادة
يجب عليك الانتباه انه لا يمكن التعديل على ملفات اكسل في ArcGIS بسبب:
Excel tables are read-only in ArcGIS as well as read-only in Excel when you have a workbook open in ArcGIS.

Field names are derived from the first row in each column of the worksheet. You can view the properties, set aliases for the field names, and set field visibility on the Fields tab of the table's Properties dialog box.

Excel does not enforce field types for values during data entry like standard databases do. Therefore, the field type specified in Excel is not used in determining the field type exposed in ArcGIS. Instead, field type in ArcGIS is determined by a scan of the values in the first eight rows for that field. If the scan finds mixed data types in a single field, that field will be returned as a string field and the values will be converted to strings.

Numeric fields are converted to the Double data type in ArcGIS.

Excel tables behave like other tables that don't have an ObjectID field. This means you will be unable to edit, perform relates, or make selections on the map. (Note: ArcMap does not convert any column from Excel into an ArcGIS ObjectID field. For example, a numeric column named "OID" or an autonumber field will be a Double in ArcMap.)

Excel file support in ArcGIS uses Microsoft OLE DB Provider for Jet 4.0 and its supporting Excel Indexed Sequential Access Method (ISAM) driver. For more information on the Microsoft OLE DB Provider for Jet 4.0 and its supporting Excel ISAM, see Microsoft KB article 326548.

You cannot create new Excel files or export records to an Excel file in ArcGIS.

ماهر عبدالكريم

عبادة مالك
10-27-2010, 10:56 PM
اشكرك جزيل الشكر ..وهذا ما اعلمه لكن انظر الى ما قرأته على صفحات مواقع ازري ..وقمت ببعض الترجمة ...ومن شرح الموقع فانه يدل على انننا نستطيع عمل field calculator وعمل add field لملف الاكسيل المضاف ...وانسخ لكم الشرح
................
ملاحظة نستطيع تحويل ملف الاكسيل الذي بصيغة dms الى kml مباشرة بواسطة تحويل الملف النصي لاكسيل الى كوكل ايرث بواسطة برنامج كوكل ايرث open ثم تحويل kml الى شيب فايل فيظهر عمودي الاحداثيات الجغرافية بصيغة dms ومنا نستطيع تطبيق ما هو مشروح في الاسفل


HowTo: Convert Degrees Minutes Seconds values to Decimal Degree values using the Field Calculator



Summary
Instructions provided describe how to use the Field Calculator to convert Degrees Minutes Seconds stored in a string field to Decimal Degrees stored in a number field. The values must be stored in a field in a table as Degrees Minutes Seconds with no symbols. For example:

25 35 22.3

In the example, 25 is degrees, 35 is minutes and 22.3 is seconds.

Procedure
Follow the steps below.
Initially perform the steps below on positive numbers. After the conversion is complete, multiple any fields that need to be negative by -1.


1. Add the table to ArcMap.
2. Right-click on the Table in the Table of Contents and select Open.
3. Verify 'Edit' mode is not enabled. Click the Options button and select Add Field.
4. Enter Lat2 in the Name field and select Double from the Type drop-down list. If Lat2 is already used as a field name, select a name that is not used.
5. Verify that the Scale and Precision is set to 0 and click OK.
6. Right-click on the Lat2 field and select Calculate Values.
7. Click Yes if presented with a message box.
8. Check the Advanced check box.
9. Paste the following code into the Pre-Logic VBA box:
10. Dim Degrees as Double
11.
Dim Minutes as Double
12.
Dim Seconds as Double
13.
Dim DMS as Variant
14.
Dim DD as Double
15.

16.
DMS = Split([Latitude])هنا نستبدل ماهو بين قوسين بالعامود الممثل للاحداثيات درجة دقيقة ثانية
17.
Degrees = CDbl(DMS(0))
18.
Minutes = CDbl(DMS(1))
19.
Seconds = CDbl(DMS(2))

DD = (Seconds/3600) + (Minutes/60)+ Degrees

20. Find the line that begins 'DMS. . .' The text within the brackets [ ] is the name of the field holding the latitude values. Replace the word Latitude in the code with the name of the field that stores the latitude values in the table.
21. Paste the following code into the 'Lat2 =' box at the bottom of the dialog box.
CDbl(DD)

22. Click OK.
23. Repeat steps 3 through 12 for the longitude values.
Null values in the DMS field will cause an error when running the VBA code in the Field Calculator.”
الخلاصة اننا ننشا عامود جديد نوعه double وبالزر اليمين وناخذ field calculate ونضغط على advanced ونكتب الكود ونستبدل العامود المراد تحويله من dms to dd ..
ونكتب في المربع الاسفل لقائمة field calculate نكتب :
CDbl(DD)

عبادة مالك
10-27-2010, 11:00 PM
وهذا شرح اخر :
HowTo: Convert a file with coordinates in Degrees, Minutes and Seconds to a shapefile using ArcMap
Article ID: 27548
Software: ArcGIS - ArcEditor 8.1, 8.1.2, 8.2, 8.3, 9.0, 9.1, 9.2, 9.3, 9.3.1 ArcGIS - ArcInfo 8.0.1, 8.0.2, 8.1, 8.1.2, 8.2, 8.3, 9.0, 9.1, 9.2, 9.3, 9.3.1 ArcGIS - ArcView 8.1, 8.1.2, 8.2, 8.3, 9.0, 9.1, 9.2, 9.3, 9.3.1
Platforms: N/A
Summary
Instructions provided describe the process for converting point data in degrees, minutes and seconds (DMS) to a shapefile using ArcMap.

Procedure
Follow the steps below.
1. Format the coordinate values for ArcGIS to correctly interpret the data.

A. Coordinates in DMS from a file need to be formatted with spaces separating the degree, minute and second values, as shown in the example below:

80 37 40,35 00 48

B. For data in North America, the Longitude values must be negative. Note the example:

-80 37 40,35 00 48

C. Each column in the table must have a heading, that describes the data entered into that column of the table:

Longitude,Latitude
-80 37 40,35 00 48

D. The table needs a field that contains a unique identifying number for each record in the table.

ID,Longitude,Latitude
1,-80 37 59,35 00 38
2. Start ArcMap with a new, empty map once the table is correctly formatted.
3. Save the script below as 'conv_DMS2DD.cal' in ArcMap with the following steps.
4. Dim sField
5.
Dim sDMS As String, sS As String, sSuf As String, sPre as string
6.
Dim sList
7.
Dim i As Integer, j As Integer
8.
Dim iDec As Integer, iNum As Integer
9.
Dim dD As Double, dM As Double, dS As Double, dDD As Double
10.
Dim bReplace As Boolean
11.
'=============================
12.
'Change the source field name bellow
13.
sField = [dms]
14.
'=============================
15.
sDMS = sField
16.
If Len(Trim(sDMS)) = 0 Then
17.
dDD = 0
18.
Else
19.
iDec = 0
20.
iNum = 0
21.
For i = 1 To Len(sDMS)
22.
sS = Mid(sDMS, i, 1)
23.
If Not IsNumeric(sS) Then
24.
If sS = "." Then
25.
If Not iDec = 0 Then
26.
bReplace = True
27.
Else
28.
bReplace = False
29.
End If
30.
iDec = iDec + 1
31.
ElseIf sS = "-" Then
32.
sPre = "-"
33.
bReplace = True
34.
Else
35.
bReplace = True
36.
End If
37.
If bReplace Then
38.
If iNum > 0 Then
39.
Mid(sDMS, i, 1) = ","
40.
Else
41.
Mid(sDMS, i, 1) = " "
42.
End If
43.
End If
44.
Else
45.
iNum = iNum + 1
46.
End If
47.
Next i
48.
sList = Split(sDMS, ",")
49.
Dim iLen As Integer
50.
If UBound(sList) = 0 Then
51.
sDMS = sList(0)
52.
iLen = Len(sDMS)
53.
If iLen >= 4 Then
54.
dS = CDbl(Mid(sDMS, iLen - 1, 2))
55.
dM = CDbl(Mid(sDMS, iLen - 3, 2))
56.
sDMS = Left(sDMS, (iLen - 4))
57.
If (Len(sDMS) > 2) Then
58.
dD = CDbl(Right(sDMS, 3))
59.
ElseIf (Len(sDMS) = 0) Then
60.
dD = 0#
61.
Else
62.
dD = CDbl(sDMS)
63.
End If
64.
Else
65.
dDD = 0
66.
End If
67.
dDD = dD + dM / 60# + dS / 3600#
68.
Else
69.
j = 0
70.
dD = 0#
71.
dM = 0#
72.
dS = 0#
73.
For i = 0 To UBound(sList)
74.
If IsNumeric(sList(i)) Then
75.
If j = 0 Then
76.
dD = CDbl(sList(i))
77.
j = j + 1
78.
ElseIf j = 1 Then
79.
dM = CDbl(sList(i))
80.
j = j + 1
81.
ElseIf j = 2 Then
82.
dS = CDbl(sList(i))
83.
j = j + 1
84.
End If
85.
End If
86.
Next i
87.
dDD = dD + dM / 60# + dS / 3600#
88.
End If
89.
If dDD < -180# Or dDD > 180# Then
90.
dDD = 0#
91.
End If
92.
If sPre = "-" Then
93.
dDD = dDD * -1#
94.
End If

End If

A. Open a table in ArcMap.

B. Right-click a field and select Calculate Values.

C. Check the Advanced check box.

D. Copy the code above into the Pre-Logic VBA Script Code section of the field calculator.

E. Type dDD into the bottom section of the Field Calculator.

F. Click Save to save the script to a .cal file and name the file 'conv_DMS2DD.cal'.
95. Follow these steps to run the code above in the Field Calculator:

A. Add the table containing the DMS coordinates to ArcMap through the Add Data button.

B. Right-click on the table name > Data > Export and export the table to a DBF file.

C. Open the DBF table and add items named 'longDD' and 'latDD' to the table, defining these as Double, Precision 18, and Scale 13.

D. Calculate the field values for 'longDD' and 'latDD' by starting a load of the conv_DMS2DD.cal script to the field calculator.
Change the name of the field in the script to that of the original DMS fields:

'Change the source field name below
sField = [Long]

96. Right-click the DBF table and select Display XY Data after the coordinates have been converted from DMS to DD.

Define the projection for the event layer by clicking the Edit button in the 'Spatial Reference of Input Coordinates' section of the dialog box.
Defining the projection permits the data to display in the correct location in ArcMap as an Event layer.

97. Convert the Event layer to a shapefile.

A. Right-click the Event layer and select Data > Export data.

B. Select the output location for the shapefile and type in the name.

C. Click Save and OK on the Export Data dialog box to create the shapefile.