Geology & Geophysics REU GPS/GIS 1-day workshop handout #4: Working with data in ArcGIS You will create a raster DEM by interpolating contour data, create a shaded relief image, and pull data out of the DEM based on shapefile locations. You will use a bit of Arc Toolbox, Raster Math, and ArcScene Many times, you want a continuous surface even though your data are not continuous. They may be point data collected in your field area or perhaps you stayed up late last night digitizing contours. ArcGIS has a variety of interpolation routines available, and one in particular is good for creating a DEM (Digital Elevation Model) from digitized contours. Once you have a DEM, Arc can create TINs, raster surfaces, shaded-relief images (which it calls hillshades), slope images, etc. It also contours the surfaces that it creates so you can compare the interpolated results to your digitized starting data. You ll also get some practice using ArcToolbox. I CALCULATIONS WITHIN AN ATTRIBUTE TABLE 1a) Pull over the file contours.zip and un-zip it into your Waahila folder. Right-click on contours and select Open Attribute Table. You ll see that it has fields labeled Shape, id, and elev_ft. You only care about that last one, which is the elevation of each contour in feet. Feet? How unscientific is that??? The first thing we re going to do is calculate the contour elevations in meters. b) Right-click the uppermost icon in the Table window, and select Add Field You will get an Add Field window. In the Name: box, type: elev_m and click the Type: drop-down button to select Float. Then click OK. You ll notice that a new field has been added to the Table. c) Next, for each contour you are going to convert its value in feet to meters by dividing by 3.28 (that s why the values have to be floating-point). Remember that to actually produce data in a field you should be in Editing mode, so click Editor -> Start Editing. Then in the Table window, right-click on elev_m and select Field Calculator. d) You will get a Field Calculator window where you can build an expression to convert elevation in feet to elevation in meters. Notice that the start of the expression is already there for you; it says elev_m = e) Double-click on elev_ft in the Fields: box then click the / button and finally, type 3.28 Your expression should look like: [elev_ft]/3.28 f) Click OK and after thinking a while, Arc will populate the elev_m field with values. If these values look good to you, click Editor -> Save Edits and then Editor -> Stop Editing. You can actually do these calculations outside of an Editing session, but if you make a mistake you cannot use the undo button.
Obviously, being able to populate a field with values is a very useful tool and of course your expressions can be way more complicated than merely dividing by 3.28, but you get the picture. 2 II CREATING A DEM FROM DIGITIZED CONTOURS Arc has a super-useful way of producing an accurate DEM from digitized contours called Topo to Raster. There is a discussion of the technique on-line at: http://resources.esri.com/help/9.3/arcgisengine/java/gp_toolref/geoprocessing_with_3d_analyst/us ing_topo_to_raster_in_3d_analyst.htm I like this line: It is essentially a discretized thin plate spline technique (Wahba, 1990), for which the roughness penalty has been modified to allow the fitted DEM to follow abrupt changes in terrain, such as streams and ridges. HUH??? 2a) Open ArcToolbox. You will see that it has a ton of different tools. Many of these also used to be available as toolbars in ArcMap itself, but they seem to be moving away from this. For example, you can open up a 3D Analyst toolbar, but it doesn t have much in it. This does help to clear up the clutter of lots and lots of little toolbars all over the place. Also, as new versions of ArcGIS come out, they sometimes move various functions among the different tools. b) In some instances, you will find that certain tools don t work because they are not activated. What? Arc considers some of its features Extensions, meaning that you have to pay more to get them. Even if you pay for, and install, the extensions, they are not available to you unless you activate them. This is really dumb why would you buy and install extensions if you don t intend to use them? Anyway, before you get started, in the main top-level menu, click on Customize -> Extensions You will get an Extensions window. Make sure that the boxes next to 3D Analyst and Spatial Analyst are checked, and click Close. c) Note that next to each entry in ArcToolbox is a box with a + sign, and if you click on this (or double-click the words) you see that there are lots and lots of different tools. In some cases, there are multiple levels of tools that can be used. Finding (and remembering) where they are is often tricky. You can always search on Google. 3a) Click the + next to 3D Analyst Tools and then the + next to Raster Interpolation. You will see all of the interpolation types that we talked about in class. b) Double-click on Topo to Raster. You will get a Topo to Raster window. This is the typical look of ArcToolbox functions, and you will become familiar with it pretty quickly. Typically, you enter one or more input files (depending on what you want to do), output files, various options, and then click OK. One nice thing is that as you click on a box to enter something, help information shows up in another box over on the right.
3 c) In the Input feature data box, click the drop-down arrow and select your contours shapefile. If you ever need a shape file that isn t part of the current map you re working on, you can click the folder icon and search for it. d) Your contours shape file will show up in the large box below, and you ll notice that it has columns. In the column labeled Field, it is asking for the field in the contours attribute table that holds the elevation data. The default is the Id field, which almost certainly does not hold the elevation data. Click on ID and use the dropdown arrow to select the field that does contain the elevation values (elev_m). e) In the Output surface raster box, click on the folder icon and navigate to where you want the output to go. Call your file T2Rast. Note that output raster file names are limited to 13 characters, and can t have spaces. There are lots of other options you can play with, but the defaults are reasonable, so for now, click OK. f) The Topo to Raster window will go away and you may think that nothing is happening. Topo to Raster is a pretty computationally-intensive routine, so it takes Arc a while to finish. Eventually it will, however. But sometimes it doesn t, and you get an error code of 010168. The easiest solution is to save your file as is, close ArcMap, open ArcMap, and try again. There seems to be a bug in Topo to Raster. There is discussion of this here, but no obvious solutions: https://geonet.esri.com/thread/58804 g) The DEM will appear on your map, and it will be symbolized with a default color scheme that ranges from army green (low elevations) to white (high elevations). Feel free to change the symbology. III MAKING A SHADED RELIEF (=HILLSHADE) IMAGE Shaded relief images are probably the best way to present topography to a non-contourreading audience. An excellent combination is map layers made partially transparent so that the shaded relief shows through. You can make a shaded relief image of any raster surface it does not have to be topography. 4a) In Raster Surface, (in ArcToolbox) double-click on Hillshade. You will get a Hillshade window with boxes to fill in that are pretty self-explanatory. Azimuth is the compass direction that you want the illumination to come from (0 and 360 are north, 90 is east, 180 is south, and so on). Altitude is the angle above the horizon that you want the illumination to come from. Note that lots of people have trouble with shaded relief images that are illuminated from the south (hills look like holes and vice versa). Create a shaded relief image of your topo-to-raster DEM. b) Your shaded relief image will show up. Try placing it under the topo map, and setting the topo map to be partially transparent. See how cool this is?
c) If you ever find yourself unable to change the order of layers, note that in the Layers box (ArcGIS 10 calls it the Table of Contents), you have some options for how data are listed. The only option that allows you to move the order is List By Drawing Order, the one on the farthest left. 4 IV EXTRACTING POINT DATA FROM A RASTER IMAGE This is a very useful tool because it allows you to extract the pixel value of a raster image at the location of points in a point shapefile. Say, for example, you had a raster image that indicated topography, and a point shapefile of tree locations. With this tool you could determine the elevation of each tree. Wait, you have exactly these data! In our example, we re going to extract elevation points from the interpolated DEM (T2Rast) and use these to play around with various interpolation routines. 5a) In ArcToolbox, click on Spatial Analyst Tools -> Extraction -> Extract Values to Points. You will get an Extract Values to Points window. The self-explanatory boxes to fill in are the Input point features (trees) and the Input raster from which you are going to extract the points (T2Rast), and the name of the output point shapefile that will hold the raster values (in a field called RASTERVALU). Call this output shapefile tree_elev. Click OK. b) Once ArcToolbox is finished, tree_elev will become part of your map. Open its attribute table to confirm that you have a RASTERVALU field, and do a quick check to make sure all the values make sense. If, by bad luck, one or more of the points ended up off the edge of the interpolated DEM, its value will be -999, and you don t want to include it in any interpolation. c) To delete a bad point, get into Editor, open the attribute table, and click in the box to the left of the point s FID. Click the Delete key on your keyboard. Click Editor -> Save Edits and then Editor -> Stop Editing. VIII COOL PERSPECTIVE VIEWS 6. Save your file and start the program called Arc Scene: It will look a lot like ArcMap, but with some different buttons. a) Use the Add Data button to import T2Rast, just like you would add data to a map in ArcMap. After the computer does a bit of thinking, you will see a grey-scale version of the DEM in sort of a perspective view. b) Note that the cursor has a funny shape, and that if you hold the left mouse button down, you can tilt and rotate the view.
5 c) But everything looks flat where is this, Flori-duh? If we want a perspective view, we need to tell Arc Scene to use the z values as topography. 7a) In the Table of Contents, right click on T2Rast and select Properties You will get a Layer Properties window. Click on the Base Heights tab. Click the button next to Floating on a Custom Surface: and make sure that T2Rast is the file showing in the box. Click OK. b) Now the data are displayed in perspective view. By holding down the left mouse button you can rotate the data. By holding down the right mouse button and scrolling up or down, you can zoom in or out. 8. You can also make the DEM a little prettier by changing its display colors. Again, right-click on your DEM and select Properties Click on the Symbology tab. Click the Color Ramp dropdown arrow and select a color ramp you like. Then click OK. Much nicer, right? IX DRAPING DATA OVER THE DEM What is really cool is to drape other data sets over the DEM. This draping business may not be all that useful for quantitative analyses, but it really helps to visualize your data. It is also very useful for producing figures for presentations. 9a) You don t have too much to choose from yet, but try importing USGS_Honolulu_part.jpg. It will appear underneath the 3-d rendering of the DEM as a flat plane. How come? Just as when you initially pulled the DEM into Arc Scene, it needs to be told to use a z value of some type. b) For each data set you import into ArcScene, you need to repeat step 14, but in the Floating on a Custom Surface: choice, don t use the data set itself for the reference heights. Instead, use the DEM (T2Rast in this case). c) Note that you will probably get better results by turning off the DEM itself (un-click it in the Table of Contents, don t remove it from the map). d) Import your burnscar shapefile and drape it over USGS_Honolulu_part.jpg. It might look kind of sucky. This is because once you set the base heights, they are exactly the same as those of USGS_Honolulu_part.jpg. It is as if they are woven through each other. The way to fix this is to right-click on burnscar and select Properties and click the Base Heights tab. Down near the bottom where it says Add a constant elevation offset in scene units enter 1 in the box, and click OK. The burnscar should now show up nicely on top of USGS_Honolulu_part.jpg.