# Vector topology

## GRASS GIS topology management

### Topology general characteristics

- geometry and attributes are stored separately (concept:
*don't read both if it is not necessary*- usually it is not) - the format is topological (areas build from boundaries)
- currently only 2D topology is supported (also 3D faces but no true 3D topology with kernels)

Topology is stored for **native GRASS GIS vector format** (the default). In case of linked OGR sources (see v.external module), only pseudo-topology (boundaries constructed from polygons) is written.

The following **topological rules** apply to the vector data:

- Boundaries should not cross each other (i.e., boundaries which would cross must be split at their intersection to form distict boundaries). On the contrary, lines can cross each other, e.g. bridges over rivers.
- Lines and boundaries share nodes only if their endpoints are identical. Lines or boundaries can be forced to share a common node by snapping them together. This is particulary important since nodes are not represented in the coor file, but only implicitly as endpoints of lines and boundaries.
- Common area boundaries should appear only once (i.e., should not be double digitized).
- Areas must be explicitly closed. This means that it must be possible to complete each area by following one or more boundaries that are connected by common nodes, and that such tracings result in closed areas.
- It is recommended that area features and linear features be placed in separate layers. However if area features and linear features must appear in one layer, common boundaries should be digitized only once. For example, a boundary that is also a line (e.g., a road which is also a field boundary), should be digitized as a boundary to complete the area(s), and a boundary which is functionally also a line should be labeled as a line by a distinct category number.

Vector map topology can be cleaned at user level by v.clean command.

More details in the manual at: Vector model and topology

## GRASS GIS: pseudo-topology and real topology

**Q:** What is the difference between pseudo-topology (v.external`) and real topology?

**A:** The differences are listed in the table below.

Basically a full topological format knows what 'network' is so that every node is directly related with his degree of connection. Boundary lines dividing areas are simply arcs connected together, there is no need to duplicate any basic geometric feature (vertex or arc), even if it belongs to more than one geometric entity.

pseudo-topological * full-topological -----------------------------------------*------------------------------------- * adjacent area boundaries are duplicated * a single boundary can share several * areas * *

## Vector data export

The topological GRASS GIS vector data can be written out to common GIS vector formats with `v.out.ogr`.

### Export of islands

If you want only isles and not regular areas in the SHAPE file, use `v.centroids layer=X` with a layer number that is unused, then `v.out.ogr layer=X` to write out the islands.

## Extracts nodes by number of line connections

See: https://gist.github.com/petrasovaa/356b2bf9671b2b6801963f4368d7db0b

## See also

- Vector topology cleaning
- Intro to vector data model (with drawing)
- see also Vector library topology management background
- Vector patching