Geography 387 Lab Home | Geography 387 Home | Geography Home

Lab 5: Data Model Transformations


Outline

  1. Introduction
  2. Rasterization
  3. Vectorization
  4. Conclusion
  5. To turn in

** Before you begin this lab, review the "General" section of the ArcGIS Tips and Tricks webpage. Don't skip this step...it will ultimately save you time!

1.0 Introduction

Although modern GIS systems can manage both raster and vector data, it is still often necessary to covert from one data model to the other. The primary reasons are that 1) the vector format stores discrete features more efficiently than does the raster format and 2) it is often necessary to have all data in one format for analytical operations. The ArcGIS software provides simple-to-use tools for converting between data models. We will experiment with these tools in this lab. Along the way, we will also learn how to store symbology in a layer file, how to measure map distances with an ArcMap tool, and how to compute summary statistics of a numeric attribute.

2.0 Rasterization

Rasterization is the process of converting vector feature data to a raster format. There are three possible types of conversions:

  • Polygon features to raster: When polygons are converted, all grid cells lying within the vector polygon are assigned the attribute value of the polygon. Edges are assigned cell values by taking the vector feature that is most dominant.

 

  • Line features to raster: Cells are given the value of the line that intersects each cell. Cells that are not intersected by a line are given a value of NoData. If more than one line is found in a cell, the cell is arbitrarily given the value of the first line it encounters when processing. Using a smaller cell size during conversion will alleviate this problem, but could considerably increase storage requirements.

 

  • Point features to raster: When converting points, cells are given the value of the points found within each cell. Cells that do not contain a point are given the value of NoData. If more than one point lies within a cell, the cell is arbitrarily assigned the value of the first point encountered when processing. Using a smaller cell size will also alleviate this problem.

The cell size you choose when converting from vector to raster should be based on several factors, mainly the resolution of the input data, the output raster resolution needed to perform analysis, the need to maintain an efficient processing speed, and storage limitations.

2.1 The Scenario

The invasive weed, Yellow Starthistle, has aggressively spread throughout many regions of California. You have been hired by Pepperwood Preserve (just Northeast of Santa Rosa) to develop a GIS model that predicts habitats that are susceptible to the establishment of this species. To complete this task, there are several basic data layers in vector format that need to be converted to raster. The data layers to convert are 1) a polygon vegetation map classified as forest, grassland, and chaparral, 2) a line map of trails, and 3) a point map of 87 field plots characterizing the abundace of Yellow Starthistle.

2.2 Import the vector data

You should create a Lab 5 folder in the computer's local E:/Workspace. Download the following lab5.zip archive. This contains several coverages and one Dbase table in a folder called pepperwood.

We are going to start this section by importing a series of Arc/Info coverage feature classes into a personal geodatabase. Begin by opening ArcCatalog. You may have to use the F5 key to refresh ArcCatalog so that it sees the coverages in the pepperwood folder. Create a new geodatabase in your Lab 5 folder (you did this in Lab 4 ). Rename it "Pepperwood_Geodatabase". Now open ArcTools and find the "Feature Class to Geodatabase (multiple)" tool (hint: search for it in the Index tab of ArcTools).

Use the browse button next to the Input Features window to locate the coverages in the unzipped pepperwood folder. Go into the vegmap coverage and select polygon (see screen shot below), then click add. You should see the vegmap\polygon layer appear in the line below the Input Features window (note: the full file path may be different than shown). Click the browse button again to add another coverage feature class. You will be in the vegmap coverage folder, so you need to go up one level with the "up one level" button . Go into the samplespt coverage and select the points feature class. Repeat these steps to add the roads and boundary arc (line) feature classes. Your final list will have four coverage feature classes. The output geodatabase should be your Pepperwood_Geodatabase. Click OK to run the feature class import tool.

Adding feautre classes to the geodatabase

Use your skills from Lab 4 to import the "vegmap_table.dbf" table into your geodatabase. Preview the table and note the field names. Open the vegmap polygon feature class in your geodatabase and note its field names.

Question 1 :

Which key do the two tables share that could be used in a table join? (hint: it is not OBJECTID).

2.3 Symbolize the vector data

Open ArcMap. We will now load the layers from our geodatabase and symbolize them with some cartographically appropriate colors. Throughout this step, be sure to use feature classes and table from your Pepperwood_Geodatabase, NOT the original coverages or dbf table.

Add the vegmap_polygon feature class and the table to your map document. Use your skills from Lab 4 to join the table to the feature class using the common key that you identified in Question 1. Open the feature class symbology tab and chose the Categories, Unique Values symbology option. For value field, choose the VEG_TYPE field. Click the Add All Values button. Deselect the <all other values> option. Considering our lecture on cartographic design, choose appropriate colors for each class by double-clicking on the color patch for each class, and finally click OK.

Load the boundary_arc feature class, which delineates the boundary of Pepperwood Preserve. Click the line symbol below boundary_arc layer in the table of contents (TOC). The symbol selector box opens. Choose the Boundary, State symbol in the Symbol Selecter window.

Next load the roads_arc feature class. Open the Symbol Selecter and choose the Major Roads symbol.

Load the samplepts_point feature class. Just change the color to red.

Your layers should look similar to the following screen shot:

2.4 Polygon features to raster

We will now convert the feature classes to raster layers. In ArcTools, go into Conversion Tools, then To Raster, and select the Feature to Raster tool. For Input Features, select your vegmap_polygon feature class. For the field, we are going to use the vegmap_table.VEG_TYPE field from the joined table (see screenshot below). Direct the output raster to your geodatabase, and call it vegmap_raster_10. Use an output cell size of 10. The units of the cell size are in linear units of the feature class, in this case meters (m). Click OK to run the feature-to-raster conversion tool.

Feature to Raster

Go to the Layer Properties of your output vegmap_raster_10, then to the Source tab, and answer the following questions:

Question 2 :

a. How many columns and rows make up the raster?

b. What is the pixel type?

c. What is the projected coordinate system?

d. What kind of raster compression method is used?

Go to the Symbology tab for the vegmap_raster_10 and select Unique Values, and Veg_type for the value field (note: the default field is Value). Use the same colors for the different classes that you used for vegmap_polygon. Right-click on the vegmap_raster_10 layer in the TOC and select "Save As Layer File...". This will save your symbology for the raster layer in a small file called a "layer file". We can then symbolize similarly coded rasters with the layer file. By the way, layer files work with feature classes as well. We'll see this in action in the next step.

Repeat the Feature to Raster tool steps above to convert vegmap_polygon to a raster with a 50 m cell size. Call the raster vegmap_raster_50. Go to the symbology tab for this raster and click on the "Import..." button. Browse to the layer file (.lyr extension) that you created above. Click OK. The symbolization for vegmap_raster_10 and vegmap_raster_50 should be exactly the same.

Rasters in ArcMap

Turn on and off the various vegmap polygon and raster layers and use the zoom tools to answer the following questions:

Question 3 :

Which of the conversions (10 m or 50 m) do you think more accurately represents the original vector polygon map? Why is this the case?

 

Question 4 :

Are any polygons in the original vector layer eliminated due to the rasterization using 50 m resolution? 10m resolution? Why the different in results?

 

Save your map document. Name it lab5_base_map.mxd.

Save another copy of your map document. This time name it lab5_layout_map.mxd

For the following map layout, you will need to load another copy of the vegmap_polygon layer. Go to the symbology tab and this time just select Single Symbol symbology. Click on the colored Symbol patch and select "Hollow" in the Symbol Selecter. Make sure that this hollow symbolized vegmap_polygon is on top of the raster layers. Select the Labels tab in vegmap_polygon properties. Check the "Label features in this layer" box and change the label field to VEGMAP_ID. Go ahead and turn off the drawing of all the other layers in the TOC except the hollow vegmap_polygon and the two rasters.

Label window

Map 1
Produce and export a map layout with two data frames--one for each raster resolution. For the 50-m resolution raster, zoom in on five polygons that have been eliminated due to rasterization. For the 10m-resolution raster, zoom to the same extent and show how these polygons were preserved. To display the correspondence between the vector and raster formats, overlay the hollow vegmap_polygon on top of the raster in each map. There should be labels for each polygon displayed on your map. Remember also the presentation quality also counts. Be sure to include a meaningful title, legend, scale bar, north arrow, your name, etc. Use guides and rulers to help design your map. Export the map to a PDF file with 150 dpi.

Additional help: A way to make this task easier is to set up one data frame with the 50-m raster showing and the 10-m raster turned off. Overlay the hollow vector polygons and zoom into an area with at least 5 patches that have been eliminated due to the rasterization process. Size this data frame into one half of your map layout. Next, copy and paste the data frame so that you have a duplicate copy. Move this new data frame into position in the second half of your layout. In the second data frame, turn off the 50-m raster and turn on the 10-m raster. You should now have two data frames with the same map extent (e.g., zoomed in on 5 elminated polygons), but one with the 50-m raster underneath and the other with the 10-m raster underneath.

Save your changes to your lab6_layout_map.mxd map document.

2.5 Line features to raster

We will now investigate the effects of converting linear vector features to raster. We will no longer work with the lab5_layout_map.mxd map document. Open your lab5_base_map.mxd map document instead.

Turn off the display of all layers in the TOC and turn on the roads_arc feature class. Use the Feature to Raster tool to convert the roads_arc feature class to a 10-m raster using ROADS_ID as the cell value. Choose a raster name that allows you to remember what you did. Run the tool again to create a 50-m raster. Zoom in on areas to compare the original vector lines to the new raster layers. We will return to these raster road layers in the Vectorization section.

2.6 Point features to raster

We will now investigate the effects of converting point vector features to raster. Turn off the display of all layers in the TOC and turn on the samplepts_point feature class. Use the Feature to Raster tool to convert the samplepts_point to a raster layer with 10-m cell size. Use SAMPLEPTS_ID as the value field. Repeat the steps to create a raster with 50-m cell size. Be sure to name your layers so that you can tell what you did later.

For point data, there can be a considerable amount of precision error when converting vector data layers to raster grids. In this exercise, you will estimate how much the rasterization process offset the location of sampling points. To do this, familiarize yourself with the Measure tool Measure tool located on the Tools toolbar. With the "Measure Line" measure line option selected, the Measure tool allows you measure the distance between one point and another by clicking on the first point and dragging the cursor the second point. The distance (length) measurement appears in the Measure tool's window. You can snap to points by toggling on the "Snap to Features (on/off)" Snap option option. See example below of measuring the distance between 2 vector points. I first clicked the red point (snapped), then double-clicked near the purple point to snap. A linear distance for the line is shown for "Line Measurement". The segment length and total line length are the same. If I were to continue to click more points, then there would be a lenght displayed for the last line segment digitized, and a total length for the entire line composed of multiple segments.

Measuring distance between two lines

Using the measure tool and the table below, measure and record the displacement/error due to rasterizing of the samplepts_point feature class for the selected sampling points. You can use a combination of label feature in the samplepts_point properties, select by attributes or the identify tool Indentify tool to find each vector point's location. Measure distance from the vector point center to the center of the raster cell. You will NOT be able to snap to the raster's cell center because snapping only works on vector features. However, you can at least snap to the vector point and then estimate where the cell center is located. Your answers do not have to be exact!

Question 5:

SAMPLEPTS_ID

Displacement/Error (m)

10 m Raster

50 m Raster

21

 

 

22

 

 

24

 

 

30

 

 

33

 

 

40

 

 

43

 

 

46

 

 

3.0 Vectorization

Vectorization is the process of converting raster feature data to a vector format. Continuous raster data (e.g. DEMs) are rarely converted to vector because raster is a superior data model for representing spatial variability of continuous phenomena. An exception to this example would be the conversion of a DEM to a TIN or vector elevation contour lines.

As with rasterization, there are three possible types of conversions.

  • Grouped raster features to vector polygons: Vector polygons are built from groups of contiguous cells having the same cell values. Lines are created from cell borders in the raster. Continuous cells with the same value are grouped together to form polygons. Cells that are NoData in the input raster will not become features in the output polygon feature.
  • Linear raster features to vector lines: When you convert a raster representing linear features to vector lines, a vector line is created from each cell in the input raster, passing through the center of each cell. Cells that are NoData in the input raster will not become features in the output vector line feature.
  • Raster point features to vector points: When you convert a raster representing point features to vector points, for each cell in the input raster, a point will be created in the output. Each point will be positioned at the center of the cell that it represents. NoData cells will not be transformed into vector points.

To examine the effect of vectorization from rasters, we will use our output rasters from Section 2.

3.1 Raster to polygon features

Turn off the display of all layers in the TOC...you can do this quickly with a right-click on the data frame, then "Turn All Layers Off". In ArcToolbox, go to the Conversion Tools, then From Raster, then select the Raster to Polygon tool. For the input raster, select your vegmap_raster_10 raster layer. Use Veg_type as the field. Put your output polygon feature class in the Pepperwood_Geodatabase and give it a logical name, like "vegmap_raster_10_to_polygon". There is an option to "Simplify polygons". This will smooth the boundaries of the output polygons, reducing their "stair-stepped" appearance resulting from the raster cells. Uncheck this box--we will not use this feature for now. Click OK to run the tool. Repeat these steps for the vegmap_raster_50 raster layer.

Vegetation vectorization

By completing the table below, compare the area of each land-cover type as represented in the original vegmap_polygon feature class and the polygon feature classes vectorized from the 10-m and 50-m rasters. To summarize the areas in the cover types, open the attribute table for each feature class, then select the Veg_type field, and right-click select Summarize. Use Veg_type as the field to summarize, and then select the Sum of Shape_Area for the summary statistic. Save your output to a Dbase file (.dbf) outside of the Geodatabase so that you can open it in Excel (like we did in Lab 2). For the vectorized feature classes, your Summarize window will look like this:

Summarize landcover area

For the original vector layer, use the vegmap_polygon feature class with the joined table. Your Summarize window will look like this:

Summarizing the landcover area of vegmap_polygon

Combine your area summaries from the exported DBase files into one Excel worksheet and paster your answers into the summary table in Question 6. Your values for area should all be fairly similar regardless of the feature class. Large differences mean that there was a problem. When summarizing the original vegmap_polygon feature class, you can use the AREA or Shape_Area field for the area sum...it produces the same result.

Question 6:

  Vegmap_polygon Vectorized Raster, 10m Vectorized Raster, 50m
Chaparral      
Evergreen Forest      
Grasslands      
Mixed Forest      

For Question 7, refer to the data in the table in Question 6. Students may have answers that vary, so interpret the data that you have in YOUR table and you will get full credit for Question 7.

Question 7 :

a. In the polygons vectorized from the 10-m raster, which class(es) increased in area relative to the original vegmap_polygon feature class?

b. In the polygons vectorized from the 10-m raster, which class(es) decreased in area relative to the original vegmap_polygon feature class?

c. In the polygons vectorized from the 50-m raster, which class(es) increased in area relative to the original vegmap_polygon feature class?

d. In the polygons vectorized from the 50-m raster, which class(es) decreased in area relative to the original vegmap_polygon feature class?

3.2 Raster to line features

Turn off the display of all layers in the TOC. We are going to vectorize the raster roads from Section 2.5 and compare the output to the original roads_arc feature class.

In the Conversion toolbox, open the Raster to Polyline tool. For the Input Raster, select your rasterized roads with a 10-m cell size. For the field, leave the default at Value. For the output polyline features, create a name in your geodatabase (e.g., roads_raster_10_to_line). Switch the background value to NODATA. This tells the tool to treat all No Data values as blank space. Leave the remaining parameters in their default settings. Click OK. Repeat the process to vectorize the roads raster with 50-m cell size.

Vectorization of roads

Summarize the total length of the entire road network for the original roads_arc feature class and the vectorized versions. You can retrieve the sum of the line lengths by going to the attribute table of each feature class, then select the Shape_Length field, and right-click, select Statistics. For the chosen field, this tool provides general statistics (e.g., mean, min., max, sum) from the records in the feature class (e.g., the lengths of each road line segment). These statisics can be selected and copied into your answer for Question 8.

Road length statistics

Question 8:

  roads_arc Vectorized Raster, 10m Vectorized Raster, 50m
Total Road Length (m)      

 

Question 9 :

In terms of length and visual properties, which vectorized raster layer is more similar to the original roads_arc feature class? Why?

4.0 Conclusions

In this lab your began to experiment with the data model transformations and their effects on the orignal data. In particular, rasterization cell size has profound effects on the generalization of vector features. You also found that once a vector layer has been rasterized, one can not expect to retrieve the same shape and length of features in the original data source by re-vectorizing the raster (e.g., vectorization).

5.0 To turn in

Submit electronic files via email to klacefie@sonoma-county.org, with the subject "G387, Lab 5, [your last name]".


Text portions of this lab were developed by Dr. Ross Meentemeyer, University of North Carolina at Charlotte. Condensed web version by Matthew Clark, Geography and Global Studies Department, Sonoma State University.

This page was last modified on Oct. 13, 2008 by Matthew Clark