













Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!














1.2.1 Importing Text Files to ArcMap
(1) You can access information about importing text files using the HELP Index by writing delimited in the window and clicking:
delimited text files → Accessing delimited text file data
(2) Among the most important information is the following:
ArcCatalog and ArcMap allow you to directly access data in delimited text files and work with them as tables. ArcCatalog, and the add data browser in ArcMap, lists files with a .txt, .asc, .csv, or .tab extension and assigns them a file type of Text File.
a. Files with a .txt , .asc or .csv extension are interpreted as comma delimited , while files with a .tab extension are interpreted as tab delimited.
b. If your text file is tab delimited , you should rename the extension as .tab.
NOTE: If the .txt file extension is hidden (as it is by default in the Lab) then you must reveal this extension by the following procedure.
Tools → Folder Options → View
c. If it is comma delimited you should make sure that all field names are in quotes( “name”).
NOTE: You must NOT start a field name with a number. Otherwise the file will not be properly read in either ArcMap or ArcCatalog. (This important detail is missing from the HELP files !!)
1.2.2 Changing Path Directories in Map Documents
When a red “!” appears where a map should be displayed, it usually means that your maps are in the wrong directory. To change all such maps with a single operation:
(1) Left click on the red “!” next to the first file in the map document that has such a mark.
(2) In the Data Source window that opens, select the appropriate data source file in the new directory.
(3) Click “Add”, and the source directories of all files in the same directory as the first file will automatically be changed to the corresponding source file in the new directory (assuming that they exist).
(4) If the map document contains source files in more than one directory, some files will still have a red “!”. So left click on any one of these, and repeat the above procedure.
1.2.3 Making a Column of Row Numbers in an Attribute Table
Here there are two procedures that one can use:
1. Modify FID Numbers
If the FID column of string identifiers is present, and in the correct order, then you can simply construct a numerical field that adds “1” to each FID number as follows:
(1) Open the Attribute Table and select Options → Add Field.
(2) Set Name = “ROW” and leave all else as is. Click OK.
(3) In the new column that appears (with zero values) right click on the ROW label and select Calculate Values. (Ignore any warnings)
(4) In the Field Calculator that opens, fill in the window labeled “ROW =” with the phrase “[FID] + 1” (no quotes), and click OK. The column should now be filled with the desired row numbers.
2. Construct an Independent Numbering
An alternative procedure that is more flexible is to use the utility, rec_Number.cal , in the class directory, Sys502\Arcview\Projects\Utilities , as follows:
(2) Next be sure that the “Editor” toolbar is displayed ( View → Toolbars → Editor ), and click: Editor → Start Editing. Then click Create New Feature on the toolbar (“pencil” button), and be sure that the layer “Boundary” is set as the Target.
(3) To create the mask, use the mouse to make a large “Box” around the map boundary. Just click at each successive corner, and then right click anywhere inside the Box and select Finish Sketch on the popup menu. The map should now be hidden under the colored Box. Click: Editor → Stop Editing → Save Edits.
(4) If you open the Attribute Table for “Boundary” you will see that a new row (feature) has been added at the bottom, representing the polygonal Box just created. You will now create a new shapefile in which the complement of “Boundary” in the Box is also a feature.
a. First open Arc Toolbox and click:
Analysis Tools → Overlay → Union
b. In the “Union” window that opens, set Input Features = “Boundary”.
c. In the Output Feature Class window, the default file name should be boundary_Union.shp. Rename this to mask.shp and click OK. The layer “Mask” should now appear in the Table of Contents.
d. Now with only “Mask” being displayed, you should see both “Boundary” and the Box surrounding it. Use the Select feature on the Main Menu to select the complement of the “Boundary” (right click anywhere in the Box outside of “Boundary”).
e. Open the attribute table for “Mask” and observe the row selected (which should be the top row). Click on Options at the bottom of the window, and choose “Switch Selection”, so that all other rows are now selected.
f. Now reopen the Editor , click “Start Editing”, and in the Main Menu select Remove. All that should be left is the complement of “Boundary” in the Box. This constitutes the desired Mask.
g. To clean up the original file, open “Boundary” again, select the row corresponding to the Box feature, and click Remove. Finally, click:
Editor → Stop Editing → Save Edits.
(5) To display the Mask in a proper form, double click on its colored box in the Table of Contents, set Fill Color = “White”, and set the Outline Width and Outline Color to whatever you like.
(6) Once again display the “Boundary” layer and enlarge it with the “Fixed Zoom In” tool to fill the window. Be sure that the “Mask” layer is positioned above it in the Table of Contents.
⇒ Any raster or contour output from subsequent analyses of point data inside the map will now automatically be clipped at the boundary as long as those displays are positioned below the “Mask” layer in the Table of Contents.
1.2.5 Making Spline Contours in Spatial Analyst
(1) Select a point-data layer with values “X” to be contoured.
(2) On the Spatial Analyst tool bar Click:
Spatial Analyst → Interpolate to Raster → Spline
(3) Then in the Spline Window set:
(4) If a raster grid of colors is OK, then you are done.
(5) If you want contour curves rather than a raster grid, you can now use the “Surface Analysis” tool as follows. Select the raster-grid layer and click:
Spatial Analyst → Surface Analysis → Contour
(5) If you open the folder you will see one .gif file with a label something like slide_0001. This is the file containing the desired image (open it to check).
(6) Now copy this file to the same local directory where you keep the copy of your web page, and rename it as say image.gif.
(7) You can then insert this into your web page by editing the page in Netscape using File → Edit Page , and then using Insert → Image.
(8) In the “Image Properties” window that opens, just type in the name of the file, image.gif , and it will be inserted.
(9) It is often easier to control the placement of the image by first creating a table in the web page using, Table → Insert Table , and then inserting image.gif into an appropriate cell of the table.
(10) Finally, you can publish the web page in the usual way, by FTPing the image file to same directory on the server where your web page is kept.
1.2.8 Adding Areas to Map Polygons
The following instructions are adapted from the help file in ARCMAP:
Dim dblArea as double Dim pArea as IArea Set pArea = [shape] dblArea = pArea.area
NOTE: On some old boundary files (such as lymph_bnd.shp in the Uganda example of Assignment 1) will yield a negative area, because the ordering of points is reversed. Here just change variable name in (7) above to Abs(dblArea). This will replace dblArea by its absolute value.
1.2.9 Adding Centroids to Map Polygons
The following instructions are adapted from the help file in ARCMAP:
Dim dblX as double Dim pArea as IArea Set pArea = [shape] dblX = pArea.Centroid.X
Dim dblY as double Dim pArea as IArea Set pArea = [shape] dblY = pArea.Centroid.Y
and using the variable name dblY.
1.2.10 Adding Coordinate Fields to Attributes of Point Shapefiles
The following instructions are adapted from the help file in ARCMAP:
4. To make the transformation you will use the Visual Basic function, CDbl(.) , that converts Strings of numbers to Double-valued data. In the Field Calculator box labeled ‘TRACT_NUM = ’ type:
CDbl([TRACT])
5. Now click OK , and the new set of Double-valued data should appear in the column TRACT_NUM of the attribute table.
Procedure for Long Numbers
The above procedure will work for integers as long as you have no more than seven digits. If you have a long integer, like an STFID identification number for a Philadelphia city block, say “420171001021001” then you will not be able to reproduce this reliably as a number. The format “Double” only allow 7 places before the decimal (and “Long Integer” only allows 9 places). So it will be recorded in scientific notation, like “4.20171e+014”. These are not reliable for matching identifiers in join operations. So if the number displayed is in scientific notation, then the following additional steps can be used to correct this:
6. In the Table of Contents, right-click on the layer with the Attribute Table of interest and select: Properties → Fields. 7. Suppose you are converting STFID to a numerical field called STFID_NUM. Then in the “Layer Properties” window that opens, scroll down to the STFID_NUM row, and in the “Number Format” column click on the gray button with 3 dots. 8. In the “Number Format” window that opens, select Category = “Custom”, and select String Format = “0”. Click OK , and in the Layer Properties window click Apply and then OK. 9. If you check the Attribute Table again, then the full digit number for STFID_NUM should now be displayed.
NOTE 1. The same procedure can be used to convert integer strings to numerical integers by designate the data type of the column as ‘Short Integer’ and using the Visual Basic function CInt(.) in place of CDbl(.).
NOTE 2. There is also a VBA function CStr(.) which will convert numbers to strings. This may sometimes also be useful
1.2.12 Displaying Proper Distance Units
When boundary shapefiles are in unknown units, there is usually problem getting the distance measurement tool to show distance values in the same units as the unknown coordinates. To accomplish this:
1.2.13 Editing Point Styles in ARCMAP
For maximum flexibility in choosing colored points with or without borders, the following procedure is useful. For sake of concreteness, suppose you wish to enlarge a portion of a point pattern for an export display, and want to increase the size of dots and put a heavy black border around each for emphasis (so that they will print well in WORD).
(i) In the Properties section set Type = “Simple Marker Symbol”.
(ii) Set Color = “No Color”, check “Outline” and Outline Color = “Black”.
(iii) You will then see the border outline in the Preview window, and can reset both the Size and Outline Size to obtain a border with the desired thickness
2. Activate the data frame in ARCMAP containing the desired map and click: View → Layout View. You may still see many different images in the map frame shown. But that is no problem. Simply click: Insert → Legend. 3. In the “Legend Wizard” that opens select each unwanted item in the “Legend Items” window and click on the “ < “ button that is activated. This will remove that item from the list. When only the desired map layer remains, click Next and you will encounter many editing options. Just start by clicking all the way through and check to see whether the displayed legend is acceptable. (I have never used any of these editing options.) 4. Assuming that the desired legend is what you want, simply copy-and-paste it to the desired WORD document (it is the only item selected, so nothing else will be copied). When it is imported to WORD you can resize it, crop it, and relocate it next to your map.
1.2.16 Making Voronoi Tessellations in ARCMAP as Shapefiles
1. In the point file to be tessellated, you must first change the “Primary display field” to a unique integer or string field. The Object ID field (FID or OID) will usually work. Select the point file and Click:
Properties → Fields
and reset the Primary display field.
2. Next you must be sure that this file is a shape file. If not, right click on layer file and click:
Data → Export Data
and save as a shape file, say Points.shp , in the same directory. From now on we use this shape file.
3. Before constructing the Voronoi tessellation, observe that this tessellation will extend only to the smallest rectangle containing all points. If the points are inside a boundary, say Boundary.shp , and you want to extend the tessellation to the boundary, the best way is to edit the point file, adding four points at the corners of a box containing the desired boundary. (More “fictitious” point may be used as desired.) To do so, - Create a new copy of Point.shp , say Temp.shp which can be edited. Now display Temp.shp instead of Point.shp.
Spatial Analyst → Distance → Allocation
Be sure the point field is selected, and leave the “Maximum distance” blank. The resulting “temp” file will be a raster display of the Voronoi cells.
5. To convert this to vector form, select the raster layer and click:
Spatial Analyst → Convert → Raster to Features
Save the resulting file as shapefile, say Voronoi.shp , in the same directory.
6. To use Voronoi.shp as an overlay, double click on the icon below the layer name in the Table of Contents, and set Fill Color = “No Color”. You can also set the outline width and color in the same box. 7. When Voronoi.shp is overlaid onto Point.shp , it will usually stretch beyond the original boundary for Point.shp (and Temp.shp ). You can clean up this discrepancy by using the “Clip” feature in ARCMAP. To do so, open ArcToolbox and click:
Analysis → Extract → Clip
The ‘Input Features’ (layer to clip) should be Voronoi.shp , and the ‘Clip Features’ (polygon clip layer) should be Boundary.shp.
8. Save this clipped form as a new shape file, say Voronoi_cells.shp , and you are done. The temporary files, Temp.shp and Voronoi.shp , can now be deleted.
>> W_list(1:4,:)
ans = 1 1 0. 1 2 0. 1 3 0. 1 4 0.
For example, the third line says that the (row-normalized) exponential weight of County 1 with County 3 is 0.0051854. This can also be verified by displaying the (1,3) element of W as:
>> W(1,3)
ans =
0.
4. We next save this file and convert it to a format that can be read by ARCMAP as follows. First save W_list as a text file using
>> save W_list.txt W_list –ascii
Next we need to “clean” this file in EXCEL. Open W_list.txt in EXCEL and use
Format → Cells → Number
to format the first two columns as integers ( Decimal places = 0 ) and the third column as, say, a 4-digit decimal ( Decimal places = 4 ). Save as file as a tab delimited text file, W_list.txt in your home directory, which we shall assume to be S:\Home\eire.
5. Finally, recall from (1) above that ARCMAP needs to match the ID numbers in the first two columns of W_list.txt with a field numbering the Counties in Eire.shp. Since there is such a field, “ID”, we shall use this field. Open W_list.txt as a text file and add “ID” as a top line to this file, so that the first few lines now read:
ID 1 1 0. 1 2 0. 1 3 0.
6. With this text file completed, we are now ready to carry out Gi* tests in ARCMAP. To do again open the map document file F:\sys502\arcview\projects\eire\eire.mxd in ARCMAP, and also open ArcToolBox. Then navigate to:
Spatial Statistics Tools → Mapping Clusters → Hot Spot Analysis (Getis-Ord Gi)*
7. In the window that opens, set
Input Feature Class = “Eire.shp”, Input Field = “BLOOD_GRP” Output Feature Class = “Eire_G_Arcmap.shp”
8. To use the custom weight matrix above, set:
Conceptualization of Spatial Relationships = “Get Spatial Weights from File” Distance Band = “0” Weights Matrix File = “S:\Home\eire\W_list.txt”
where it is assumed that the last line contains the proper path to W_list.txt. Leave all other options as is and click OK.
9. A new layer, “Eire_G_Arcmap”, will now appear in the Table of Contents. If you open the Attribute Table you will see that the last field is labeled “GiW_list”. The values in this column are standardized Gi* values, i.e., z-values of the form:
Zi = (Gi - E(Gi))/std(Gi)*
[where exact expressions for the mean, E(Gi)* and standard deviation, std(Gi)* can be found in the Getis-Ord paper listed in the reserve section of the class web page.] To see the relevance of these values, recall that under the null hypothesis of the random permutation test, the underlying x -values (in this case “Blood Group A” percentages for each county) are assumed to be typical random permutations of these values among counties. Ord has shown that under this hypothesis, the Zi -values above are asymptotically normally distributed for large sample sizes, n. [Here there are only n = 26 counties, so this asymptotic assumption is questionable at best. But nonetheless, it will be seen below that this test provides very reasonable results in the present example.]
10. To display the results of this test in a manner that is comparable to the random permutation test, g_perm_loc.m , in MATLAB, recall that this is a one-sided test focusing only on significant concentration levels. The appropriate z-values corresponding to one-sided significance levels in this case are given by:
P-value 0.10 0.05 0. z-value 1.28 1.65 2.
Hence to display these z-values (“GiW_list”) use a classification with Classes = “4” , Method = “Manual”, and values “ 1.28 ”, “ 1.65 ”, “ 2.33 ”, and “ max ” (where in this
being entered. To do so:
(a) First be sure that the POINTS file to be added (either a DBF file or a Tab- Delimited TEXT file) has Column Labels with proper format for ARCMAP (single strings of not more that 8 symbols, with no punctuation symbols other than “_” ). Also, if you label the coordinates as “X”, “Y”, or as “X_coord”, “Y-coord”, then these will be recognized by ARCMAP as the coordinate columns.
(b) Add the POINTS file to the map document. (If it won’t come in, check the label formats again. This is usually the problem.)
(c) Right click on the POINTS file in the Table of Contents and select “Display XY Data…”. If you have chosen coordinate labels as above, then they should show already be selected in the “Display XY Data” window that opens. Also you should see that a new file, “POINTS Events”, has been added to the Table of Contents.
(d) In the Description box you should see “Unknown Coordinate System”. This is what needs to be changed. To do so, click the Edit button.
(e) You need to define a geographic coordinate system and a projection. It will be assumed here that you have Philadelphia data. So first click “Select” and go to:
Geographic Coordinate Systems → North America → North American Datum 1983.prj
(f) Now click “Select” again, and this time go to:
Projected Coordinate Systems → State Plane → NAD 1983 (Feet) → NAD 1983 StatePlane Penn. South FIPS 3702 (Feet).prj
(g) Click Add ; then click Apply and OK. In the Description box you should now see both the Projected Coordinate system and the Geographic Coordinate system listed. Click OK again.
(h) Finally, you should save the “POINTS Events” file as a shapefile by right- clicking on this file and selecting:
Data → Export Data
(j) Save this file as, say POINTS.shp. You can then join this to the polygon file by right clicking on the POLYGON file and selecting:
Joins and Relates → Join
(k) Here the best procedure for joining points to polygons is to change the “What do you want to joint to this layer?” option to read
Join data from another layer based on spatial location
1.2.19 Saving Map Documents with Relative Paths
When saving map documents it is useful to save only relative paths , so that projects can be moved to new directories without changing all paths to shapefiles, etc. This option can be set in ARCMAP by clicking:
File → Document Properties
Then at the bottom of the “Properties” window click :
Data Source Options… → Store Relative Path Names
Finally, if you check “Make relative paths the default” then this option will be used for all future map documents as well.
1.2.20 Increasing Unique Values for editing Raster Outputs (in Version 9.3)
When you use the command Spatial Analyst → Interpolate to Raster → Spline to interpolate a set of point measurements (like temperatures at weather station locations in South America), you will obtain a default “class” representation of the interpolation (as with older versions). But when you right click on properties and try to edit this representation (change the number of classes or colors, etc.) it says:
"Unique histogram does not exist. Do you want to compute values?"
When you try to do this, it will tell you that there are too many unique values. This can be fixed by increasing the bound on unique values as follows:
(1) In the main menu click: Tools → Options → Raster
(2) In the raster window you will see an additional set of tabs about half way down. Click “Raster Attribute Table”
(3) Here change the upper bound on unique values to, say, 500000. This should be enough.