Week 5: Raster <-> Vector Conversion

Back To Week 4 and Vector Overlay | On to Week 6 and Surface Analysis

Overview:


Because of the nature of vector and raster analysis, it is often necessary to convert data back and forth between the 2 data types. Certain functions, such as calculating slope for a landscape, are possible only for raster data sets. However, sometimes we need to extract data from raster data sets and associate the data with vector data sets, such as generating mean slope for a group of stream segments. Or we may wish to calculate mean elevation and aspect per stand for use in growth models.

In these circumstances, we must be able to interconvert data between these 2 basic data types. What allows us to keep attributes consistent is the grid cell value and the internal ID number for features in a coverage. VATs can be generated which can be related back to AATs and PATs.

Each of the conversion commands and functions will be discussed in turn.


Grid <-> Point

To convert points to grids, use the POINTGRID command. A new grid will be created with values representing the internal ID (default) or an item from the PAT ("value_item"). The Arc processor will prompt for cell size, extent, origin, and how to deal with background data (either make cells with a 0 value or cells with NO DATA).

Arc: POINTGRID <in_cover> <out_grid> {value_item} {lookup_table}
                 {weight_table}

You can optionally use the GRID function:

Usage:  (*) POINTGRID(<cover>,{item},{lookup_table},{weight_table},{cellsize},
                      {NODATA | ZERO})

The only difference between using the GRID function is that you have the option of supplying nearly all conversion parameters at the command line, rather than in a dialogue. In addition, you can specify output extents with the MASK and SETWINDOW commands, and the cellsize with the SETCELL command.

In the event that more than 1 input point lies within an output cell, output will either take the value of {value_item}, when specified, or "if no {value_item} has been specified and there are multiple points within the cell, the assignment is based upon the scanning order and is not easily predictable" (ARC/INFO on-line documentation).

 

To convert grids to points,

Arc: GRIDPOINT <in_grid> <out_cover> {pat_item}

or

Usage:  (C) GRIDPOINT (<in_grid>,{pat_item})

The output of GRIDPOINT will be a point coverage, with a single point located at the coordinates of the center of the input grid cell. If a {pat_item} is specified, the PAT will have an attribute value equal to the value of the grid at each non-null cell's coordinate. If no {pat_item} is specified, the output point cover will retain no value from the input grid.


Grid <-> Line

To convert lines to grids, use LINEGRID:

Arc: LINEGRID <in_cover> <out_grid> {value_item} {lookup_table} {weight_table}

or

Usage:  (*) LINEGRID(<cover>,{item},{lookup_table},{weight_table},{cellsize},
                     {NODATA | ZERO})

LINEGRID's function is analogous to that of POINTGRID. An output grid is generated, with cell value equal to either the internal ID number or the {value_item}. Background cells can be either 0 or NO DATA. As with POINTGRID, when the command is issued from the Arc: prompt, a dialogue ensues, in which cell size, etc. is specified.

Converting from a linear grid is a bit more complex. It only makes sense to convert a grid to a line coverage if the grid represents linear data. If you attempt to convert a grid which does not represent linear data, your results will be unpredictable. When you convert a grid to a line coverage, there are several options to be aware of. You can choose to select cells with only positive values, or all cells with data. The {THIN | NOTHIN} is used to thin out linear zones which are several cells wide. If the {FILTER} option is used, the boundaries between foreground and background cells will be filtered before conversion. Corners can be either rounded or sharp. As with the GRIDPOINT command, you can carry a grid value item into the line coverage. The {thickness} determines the minimum width of input linear zones. Finally, dangling arcs of a certain length can be deleted, and the {weed} option specifies the minimum distance between vertices in the output coverage.

 

Arc: GRIDLINE <in_grid> <out_cover> {POSITIVE | DATA} {THIN | NOTHIN}
     {NOFILTER | FILTER} {ROUND | SHARP} {item} {thickness} {dangle}
     {weed}

or

Usage:  (C) GRIDLINE (<in_grid>, {POSITIVE | DATA}, {THIN | NOTHIN},
                      {NOFILTER | FILTER}, {ROUND | SHARP}, {item},
                      {thickness}, {dangle}, {weed})

In addition to the GRIDLINE functionality, there is a GRID function STREAMLINE:

Usage:  (C) STREAMLINE (<net_grid>, <dir_grid>, {out_item}, {weed})

STREAMLINE is used only when generating a line coverage based on a linear grid which is the result of surface hydrologic analyses. We will perform hydrologic analyses next week.


Grid <-> Polygon

To convert between grid and polygon, use the POLYGRID and GRIDPOLY commands.

POLYGRID is used to create a grid from a polygon coverage. You can specify a numeric item from the PAT as the {value_item} in the out_grid. Use standard ARC/INFO lookup table functionality if you want. You can also assign preferential values to output grid cells in the event of possible conflicts (if one output cell lies on top of more than 1 polygon type).

Arc: POLYGRID <in_cover> <out_grid> {value_item} {lookup_table} {weight_table}

After you issue the command, a dialogue ensues in which you specify the cell size and other conversion parameters. The POLYGRID command is equivalent to the POLYGRID function in Grid.

To convert grids to polygon coverages, use the GRIDPOLY command. The output is a simple polygon cover whose polygons are determined by the extent of zones in the in_grid. The value item in the in_grid is automatically placed in the out_cover's PAT as an item called grid-code.

Arc: GRIDPOLY <in_grid> <out_cover> {weed_tolerance}


Clipping Grids

To clip a grid to the spatial extent of a polygon coverage, use a combination of the Grid function POLYGRID, the Grid commands SETWINDOW, SETMASK, and SETCELL, and the grid operator = or the CON function.

  1. Create a grid representing the spatial extent of the ultimate output grid.
  2. Set the window to the input coverage
  3. Set the mask to the input coverage
  4. Create a new grid.

For example, create an elevation grid for the area within the Pack Forest boundary (given that the elevation grid is called dem, the boundary cover is bnd4, and the output grid is pfdem):

Grid: setcell dem
Grid: bnd4g = polygrid (bnd4)
Grid: setmask bnd4g
Grid: setwindow bnd4
Grid: pfdem = dem

This method functions better than the Arc command GRIDCLIP, which simply creates a new rectangular grid based on a set of x, y coordinates.

You can also use the Arc command LATTICECLIP to achieve the same results as the example shown above, but LATTICECLIP takes much more time than the steps in the example. The other reason to use the example above is that instead of using the = operator, you can use the CON function to further limit or condition the output, whereas LATTICECLIP simply creates a carbon copy of the original grid, limited to the spatial extent of the polygon coverage.


Exercises

In lesson 3, you used a coverage of slope classes. Starting with the elevation grid for Pack Forest, recreate this slope-class coverage, but this time use classes of 10 from 0 to the maximum slope. (Hint: use DESCRIBE to find the maximum slope once you have generated the slope grid).

Create a grid representing stream segments (from the streams coverage), but whose cell values represent slope, and whose spatial extent is limited to the Pack Forest boundary.


Back To Week 4 and Vector Overlay | On to Week 6 and Surface Analysis