# Digitizing Area Features

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

# Digitizing area features with attributes

## Introduction

GIS users with experience creating and editing non-topological shapefiles sometimes encounter problems when adding attributes to area features in the GRASS digitizer. This section will attempt to offer a few tips and clear up this issue. Much has already been written explaining the strict topological vector model which GRASS uses. Please read first:
from the wiki- [1] [2]
and from the manual pages- [3]

## Problem Description

When creating a polygon shapefile, after the user finishes clicking around the perimeter of the polygon, GIS software applications will often pop up a window with all the attribute columns available and the user enters values for that polygon. In the non-topological shapefile format, the area boundary and the enclosed polygon are one and the same. Thus the boundary attributes also refer to the enclosed area. In the shapefile diagram below the labels A-1, A-2, A-3 are taken from the polygon attribute table. This fact might seem so obvious to shapefile users that they would wonder why it needs mentioning.

In the strict topological model used in GRASS, this is not the case. In a GRASS vector the surrounding boundary, and its enclosed area are two separate entities, which have two separate rows in the accompanying attribute table. The boundary is made up of line segments, and the area is represented by its centroid – a point within the closed boundary. (Centroids should be placed only within closed boundaries.) A line segment which is part of the boundary enclosing an area does not “belong” to that area, rather it often is common to two adjacent areas. In the GRASS vector diagram below, boundary B-1 separates areas A-1 and A-2. Boundaries B-3 and B-8 separate between areas A-1 and A-3. Furthermore, the boundary of area A-2 is composed of B-1, B-2 and B-5. Obviously it would not make sense to attach area attributes to any boundary, so instead the area centroids serve to connect to the attribute table rows holding the area attributes. Thus, the labels B-1, B-2, etc. come from the vector attribute table (line features) and the A-1, A-2 labels also from the attribute table are centroid features. Using the GRASS digitizer, v.digit, care needs to be taken to attach attributes to the correct features.

## Best Practices

First, it's worth pointing out that when using v.in.ogr to import a polygon shapefile into GRASS, steps are automatically taken to insure that the resulting vector gets the attributes as expected. (This behind-the-scenes procedure might actually fool naive users into believing that GRASS vectors are just like polygon shapefiles).

• Polygons are imported as boundary lines
• These lines are split at intersections, and all overlapping boundaries are removed (topologically cleaned)
• Centroids are placed in each closed boundary
• The centroids are given a cat value, and attributes from the original shapefile are inserted into the attached database

Following are suggestions for adding attributes when using the GRASS digitizer, which more or less duplicate the above process. Detailed explanations of the v.digit interface can be found both in the GRASS (Book) and the GDF Hannover (tutorial). The new wxGUI digitizer has a good manual page at: [4]

### General case

The process that users should follow when manually creating area vectors with v.digit will produce boundaries with no attributes, and a centroid connected thru its cat value to the area attributes. First, in the v.digit interface, use the settings dialog to set up the attribute table as required by the data, and choose an appropriate snapping tolerance. Also in the settings dialog, under the Attributes tab, there is a drop down list to choose Category Mode (how the cat values will be chosen). For digitizing boundaries, it is possible to choose “No category” since, as explained above, the boundary lines themselves might not require any attributes. Next digitize boundaries, being careful to

• close boundaries which delineate areas.
• never digitize overlapping boundaries twice
• be sure to enter a node at every intersection of two boundary lines (no crossing boundaries without an intersection node)

Now, back in the Settings->Attributes window, reset the Category Mode to “Next not used”, and begin to digitize centroids for each area. After marking the location for a centroid, enter all attribute data into the table relevant to that area. And that's it.

### A Special Case

There are situations where attributes need to be attached also to the boundary lines. For example: in a project mapping out species distribution, the boundaries might have an attribute value indicating the rate of spread of a species across a border. In this case, the boundaries will get a cat value (optionally defined as a separate GRASS “layer”, with a separate database connection). While digitizing, the user will enter values into the attribute table relevant to each boundary. But still, centroids need to be digitized, and attributes entered for each centroid which are relevant to the areas.

### Another Special Case

In some situations a single boundary line exactly encompasses an area, with no adjacent areas. (In other words, each area is an “isle” in GRASS terminology.) An example might be a vector map of water bodies. Obviously no water body touches any other. And the perimeter is one continuous line. Users might want the attribute table to be attached to both the area and the boundary – perhaps to display the length of the perimeter along the perimeter rather than at the centroid. In order to achieve this, boundaries will be digitized with a cat value, and the centroids will be forced to use that same cat value as the boundary. This is achieved as follows. While working on the boundary, the user should notice its category value. Next, before marking the centroid, the user will switch the Category Mode to “Manual entry”. Now she digitizes the centroid for that closed boundary and manually types in the same cat value as the surrounding boundary. This creates two vector features, a boundary line and a centroid, with identical category values, and thus a single row in the database. So all attributes are common to both the boundary and the centroid (area).

--Micha 22:12, 14 February 2009 (UTC)