# MapWinGIS:Utils GridToShapefile AmbiguityExample

This is a back-up of the WIKI.
We're working on a new wiki.

Main Page | Recent changes | View source | Page history | Log in / create account |

## Grid Ambiguity

When creating a shapefile from a grid using the Utils function GridToShapefile, ambiguities in the grid may result in a shapefile made up of unpredictable shapes. Figure 1 illustrates what an ambiguous grid is.

 Figure 1: An example of an ambiguous grid:

When the shapefile is being created from the grid shown in Figure 1, there will be an ambiguity because there are two different ways to group the grid values in the shapefile to be created.

 Figure 2: The shapes created when the grid cells with a value of one are grouped together to form a shape:
 Figure 3: The shapes created when the grid cells with a value of two are grouped together to form a shape:

When the shapes are created, either the grid cells of value one could be grouped to form one diagonal shape with two triangle shapes representing the grid cells of value two (Figure 2), or the grid cells of value two could be grouped to form a different diagonal shape with two triangle shapes representing the grid cells of value one (Figure 3). A connection grid (also known as a flow grid when working with watersheds) helps resolve creating a shapefile from grids containing ambiguities. A connection grid is created by looking at each cell in the original grid and finding which of its eight neighboring cells it is most likely to connect to. If the grid is an elevation grid, then the neighboring cell with the lowest elevation less than the elevation of the current cell would be the cell water would flow to from the current cell. The connection grid cell contains an integer representing the direction of flow. This value represents the direction of the connection for the cell. A connection grid for the ambiguous grid shown earlier is shown in Figure 4. The cell with the value four is the outlet of this flow grid. The four represents a flow direction of northwest from the corresponding cell in the original grid. In the grid shown, as indicated by the key, the value five represents water flowing to the west, the value three represents water flowing north, and the value eight represents water flowing southeast.

 Figure 4: A possible flow grid for the ambiguous grid shown above:
 Figure 5: The shapes created from the grid in figure 1 when the flow grid in figure 4 is used to create the shapefile:

A tool called TAUDEM, created by David Tarboton at Utah State University, creates a flow grid from a DEM file. For more information about obtaining TAUDEM, contact us at http://www.mapwindow.org/contact.php