Wednesday, March 7, 2007

Module 6 - Active Learning Exercise: 3D Models in ArcGIS and SketchUp - An introduction

Introduction: The abundance of high quality 3D terrain data have prompted an abundance of 3D modeling techniques to gain insight into how we interface with the world. Modeling terrain data in ArcGIS and SketchUp can provide unique visualization and analysis of 3-dimensional information. For this exercise we will work with data from Haywood County, Haywood Community College and the USGS.

Sources of this data in North Carolina include:

LIDAR - created as part of the flood mapping program for Western North Carolina

Contours - From individual county or available state-wide from NC Dot - http://www.ncdot.org/it/gis/DataDistribution/CountyMapData/default.html

Other GIS data - infrastructure and other base data available from counties and the NC DOT.

'Building out' the campus in 3D will allow for a more interactive experience when looking at the campus as a whole. This type of information will provide many different departments on campus with a robust tool to enhance decision making on a campus wide basis.

Some of the types of questions this data will be able to answer:

1. Where is the best place for a walking trail taking in consideration distance and change in elevation (or slope) as well as views.

2. What is the best layout for the 9 hole frisbee golf course the Board of Trustees recently approved and funded?

3. Where are the dark, hidden areas of campus where car break-ins are more likely to occur.

4. What is the best place for the new Geospatial Technology Center building taking into consideration the beautiful mountain views and the impact of our neighbors view after our new building has been built. We should also use this information to assess the slope of the land and existing infrastructure such as water, sewer, and fiber optics, and parking lots.

Learning Objectives:

  • Describe the different sources for 3D data in North Carolina
  • Create terrain data (TIN's) from vector based-contour data
  • Generate shapefiles in 3D
  • Assign building base heights using Zonal Statistics in Spatial Analyst
  • Extrude features based on attributes
  • Export to Google SketchUp

Steps / Procedure:

Project set-up and data preparation:

Download the data and create map document

1. Click here to download the .zip file containing the data for this exercise.

2. Create a folder in your working directory for this exercise - i.e. f:/pete/gis251/terrain

3. Unzip the data into your working directory. Keep everything from this exercise in your working directory.

4. Open ArcMap and add the following layers to your map document:

    • Buildings
    • Main Campus
    • CampusContours

5. Symbolize and organize the data as you see fit.

6. Set your map document to store relative paths (File ==> Map Properties == Data Source Options)

7. Save your map document (to your working directory) and save it often!

Establish the scale of the data frame

1. Zoom in to close enough that you can just see the campus boundary. (1:4500)

2. Don't forget to save often!

Create a TIN from the contours

1. In ArcMap, turn on the 3D Analyst Extension (Tools ==> Extensions)

2. Turn on the 3D Analyst Toolbar (View ==> Toolbars ==> 3D Analyst)

3. On the 3D Analyst Toolbar (3D Analyst ==> Create/Modify TIN ==> Create TIN from features)

4. Choose 'CampusContours', height source 'Z-FEET', and Triangulate as 'Hard Lines'. Put the 'output TIN' in your working directory.

5. Preview the TIN...make sure to order the layers in the table of contents so the buildings and campus boundary are displayed on top of the new TIN. By the way, have you saved lately? I didn't think so.
TIN example
Download and install the SketchUp ArcGIS PlugIn
This plugin can be downloaded from the Google SketchUp Plugins page. You'll need to scroll towards the bottom of the page and make sure to get the SketchUp 5 ArcGIS Plugin. I am using SketchUp 6 but this version worked for me.
  • SketchUp PlugIn Site - http://www.sketchup.com/?sid=37
  • Check the link above to see the ArcGIS and all the other plugins. For quick access to the SketchUp 5 ArcGIS plugin click here!

1. Download the file to your working directory
2. Double click and install all components to their default directories
Load the plugin into ArcGIS
1. Open your map document.
2. Tools è Customize
3. Click the Toolbars Tab è Add From File
4. Navigate to the place on your computer where the SketchUp Plugin was installed. The default location for this (i.e. where it is normally installed) is C:Program FilesArcGISSketchUp5
5. Double click the file: FeaturesToSkp.dll
6. Click OK to the added objects
7. Under the Toolbars Tab, make certain the SketchUp 5 Tools is checked and close the dialog box
You should now have a small toolbar displayed that looks like this è

Assign base elevations to buildings layers
The buildings data for this exercise must have a 'base height' to assign an elevation at ground level for the building. This data must also have some type of information that the buildings can be extruded by. This field normally holds the height of the building although this may sometimes need to be calculated using the number of stories by the height of each story. Our data in this exercise has a height field for us to extrude the buildings by but we will need to assign a value for elevation in the attribute table for the buildings.
Convert TIN to raster

The TIN we created earlier must be converted to a raster file containing elevation before going farther

1. From the 3D Analyst Toolbar, make certain the drop down box contain layer informatin èLayer: TIN
2. Convert the TIN to raster (3D Analyst èConvert èTIN to Raster)
3. Use the following settings in the TIN to Raster dialog:
  • Input TIN: TIN
  • Attribute: Elevation
  • Z factor: 1.000
  • Cell Size: 10
  • Output raster: C:ClassesGIS251_sp07Module6elevgrid (This resulting file will be a GRID. GRID file names CANNOT be longer than 8 characters)

4. Save your map document


Assign elevation to the buildings using the elevation GRID

We will use Spatial Analyst and Zonal Statistics to assign base height elevations to the attribute table of the buildings layer. Zonal Statistics will allow us to create statistics for individual zones on a raster based on the information in the raster (the elevation raster in our case). We will use the buildings layer to define the 'zones' therefore the 'zones' will be individual building polygons. For each zone (i.e. building) statistics such as maximum, minimum, mean, median and more for the elevation information in the cells within each zone (building). A table will be created of these elevation statistics and be automatically joined to the attribute table of the buildings. In the end we will use the average elevation for each building to display the buildings on a surface in SketchUp.

1. Turn on the Spatial Analyst extension: (Tools èExtensions èSpatial Analyst)

2. Display the Spatial Analyst Toolbar: (View èToolbars èSpatial Analyst)

3. From the Spatial Analyst Toolbar: (Spatial Analyst èZonal Statistics)

4. Set the zonal statistics dialog as follows:

  • Zone dataset: Buildings
  • Zone field: nombre
  • Value raster: Elevation
  • Ignore NoData: checked
  • Join output table to zone layer: checked
  • Chart statistic: mean
  • Output table: put the table in your working directory

5. Click OK

6. Save your map document

The resulting table and graph describe the "elevation" within the the zones of "buildings". There should be a zone for each building. Don't be surprised if a couple buildings do not get elevations assigned. I was having problems with 3 buildings earlier and could not find out why. Just ignore them for the purposes of this exercise.

This elevation information was also 'joined' to the buildings attribute table (open the table for buildings to see the joined fields - the . in the field names indicate that tables are joined).

This join is only preserved in ArcMap (the 2 source tables are not combined) so we need to export the buildings with the joined elevation zonal statistics table to a new shapefile in order to have all the elevation zonal statistics permanently joined to a buildings layer.

6. Right click the buildings in the ArcMap Table of Contents: (Data èExport Data) - put the new shapefile in your working directory and name it something that makes sense. I called mine bld_elev.

7. When asked if you want the new data layer added to the map, click yes.

** Note: This step is not necessary to draw buildings in 3D with ArcScene in ArcGIS. In ArcScene, base heights can be in the attribute table however if they are not the buidings could still be displayed in 3D by assigning base heights from a surface like a TIN or DEM. In this case, the elevations are not stored in the table in a place you can see or access them. To draw the buildings in SketchUp, the base height elevations MUST be in the attribute table in a column.

Export your contours and building features to SketchUp
The new buildings shapefile with base height elevations has a TON of attributes with that addition of all the elevation zonal attributes. We will be using the 'mean' elevation as a base for our buildings. This is not perfect since the 3d terrain surface of contours we wil be displaying the buildings on is continually changing across the base of the buildings meaning that the buiding footprints have not been 'stamped' into the 3D terrain surface. The other attribute used will be 'height'. We will use the 'height' attribute to extrude the buildings.

1. Turn off all layers except the new buildings layer (with elevation) and the contours
2. Click the button on the SketchUp Toolbar.
3. Select the Feature Class tab
4. For the buildings choose:
  • Elevate by field: mean
  • Extrude by field: height
  • Name group using: nombre

5. For the campusContours

  • Elevate by field: Z_FEET

6. Filename: put the new file in your working directory

7. Explore the Tins and Rasters Tabs even though we will not use them in this exercise.

8. Click OK

Viewing the data in SketchUp

1. SketchUp should have automatically opened. If it did not, double click the file to open it.

2. Click the Zoom to Extents button and explore the data in SketchUp.

Credit to the Harvard Graduate School of Design for much of the content and ideas in this exercise.

No comments: