Difference between revisions of "Vector Data"

From GRASS-Wiki
Jump to: navigation, search
m (make it less antique)
(Linear Reference System (LRS) moved out to own page)
Line 57: Line 57:
=== Linear Reference System (LRS) ===
=== Linear Reference System (LRS) ===
* see [[Linear Reference System]]
* GRASS GIS Manual: {{cmd|lrs}} - Linear Reference System Tutorial
* R. Blazek: [http://www.j-geoinfo.net/Content/fulmar05/IJG_095-100.pdf Introducing the Linear Reference System in GRASS] (March 2005, Int'l Journal of Geoinformatics, Vol. 1(3), pp. 95-100)
* R. Blazek: [http://gisws.media.osaka-cu.ac.jp/grass04/viewpaper.php?id=50 Introducing the Linear Reference System in GRASS] (Sept 2004, Conference Paper)
* http://freegis.org/cgi-bin/viewcvs.cgi/*checkout*/grass6/vector/v.lrs/MAIL
* PostGIS Reference, Chapter 6 [http://postgis.refractions.net/docs/ch06.html#id2646260 PostGIS Extensions: 6.2.7. Linear Referencing]
Linear referencing is a natural and convenient means to associate attributes or events to locations or portions of a linear feature. It has been widely used in transportation applications (such as for highways, railroads, and transit routes) and utilities applications (such as for gas and oil pipelines). The major advantage of linear referencing is its capability of locating attributes and events along a linear feature with only one parameter (usually known as measure) instead of two (such as latitude/longitude or x/y in Cartesian space). Sections of a linear feature can be referenced and created dynamically by indicating the start and end locations along the feature without explicitly storing them. http://download.oracle.com/docs/cd/B10501_01/appdev.920/a96630/sdo_lrs_concepts.htm -->
=== Specs ===
=== Specs ===

Latest revision as of 12:53, 2 September 2012

Vector Data Structures

Caveat emptor! Different terminology (eg. vertex, node, point or edge, line, line segment, link) due to different vocabulary in the underlying theories (e.g. linear algebra, graph theory, network theory) of vector data can already lead to great confusion.

The confusion is greatly enhanced by very different concepts and implementations of vector data.

Hence a discussion of the currently most widely vector data structures and formats in the geoiformatics field is surely not bad, IMO. Naturally the focus is GRASS and FOSS4G centric, maybe almost too formal form a user's point of view, and yet certainly way too informal from a programmers point of view.

The reader is assumed to be familiar with the section vectorintro (Vector data processing in GRASS GIS) in the GRASS GIS Reference Manual, the Wiki topics Vector FAQ GRASS6 and Help with 3D#Vector_3D_point_data. Also reading Vector Data Access from the Mapserver Documentation does not hurt.

GRASS 6 Vector Architecture

Grass vector line.png Grass vector area.png

The GRASS vector data model includes the description of topology, where besides the coordinates describing the location of the primitives (points, lines, boundaries and centroids), their spatial relations are also stored. In general, topological GIS require a data structure where the common boundary between two adjacent areas is stored as a single line, simplifying the map maintenance.

The following vector objects are defined:

  • point
  • line: directed sequence of connected vertices with 2 endpoints called nodes
  • boundary: the border line to describe an area
  • centroid: a point within a closed boundary (missing centroids can be created with v.centroids)
  • area: the topological composition of centroid and boundary
  • face: a 3D area;

Further following vector objects are defined, but not yet fully implemented/used:

  • kernel: a 3D centroid in a volume (exists, but currently mostly unused)
  • volume: a 3D corpus, the topological composition of faces and kernel (not yet implemented)

Note: all lines and boundaries can be polylines (with nodes/vertices in between). v.build.polylines creates these.

Data Structure

a vector map <some_vector> is stored in the directory $MAPSET/vector/<some_vector>. This directory normally contains the files listed below.

  • /head: ASCII file with header information; this is more or less the stuff that v.info displays.
  • /dbln: ASCII file that link(s) to attribute table(s)
  • /hist: ASCII file with vector map change history. v.info -h can be used to display this file.
  • /coor: binary file for storing the coordinates
  • /topo: binary file for topology
  • /cidx: binary category index

Note: The creation of certain files can be disabled. The -t flag supported by v.in.ogr and v.in.ascii disables the creation of an attribute table. The -b flag supported by r.to.vect and v.in.ascii disables the creation of a topology file. This is needed and useful e.g. for very large datasets (> 3 million points). The user is expected to understand what s/he is doing.

Linear Reference System (LRS)



ESRI Shapefile

A shapefile stores non-topological geometry and attribute information for the spatial features in a data set. The geometry for a feature is stored as a shape comprising a set of vector coordinates.

The following vector objects are defined:

  • Point
  • MultiPoint: a set of points
  • PolyLine: A PolyLine is an ordered set of vertices that consists of one or more parts. A part is a connected sequence of 2 or more points. Parts may or may not be connected to one another. Parts may or may not intersect one another.
  • Polygon: A polygon consists of 1 or more rings. A ring is a connected sequence of 4 or more points that form a closed, non-self-intersecting loop.
  • PointM: Point plus support for a Measure (cf. Measure in shape file)
  • PolyLineM: Point plus support for a Measure
  • PolygonM: Point plus support for a Measure
  • MultiPointM: MultiPoint plus support for a Measure
  • PointZ: 3D capable version of PointM
  • PolyLineZ: 3D capable version of PolyLineM
  • PolygonZ: 3D capable version of PolygonM
  • MultiPointZ: 3D capable version of MultiPointM
  • MultiPatch: consists of a number of surface patches, each patch describes a surface. TIN-like.

Note: the "measure" or the z-coord may always be omitted, by specifying the null element. e.g. a PolyLineZ(x,y,0,0) is the same as a PolyLineM(x,y,0) which is the same as PolyLine(x,y)

Note: Unlike Shapelib OGR does not support MultiPatch, PointM, PolyLineM, PolygonM, MultiPointM are not supported by OGR. Hence GRASS also does not support them. Postgres has an almost complete support (with some limitations, and lacking documentation)

Data Structure

a shapefile <some_vector> is actually a set of files:

  • <some_vector>.shp vector features
  • <some_vector>.shx feature index data pointing to the vector features
  • <some_vector>.dbf attributes in dBase DB format
  • <some_vector>.prj ASCII file with projection info in WKT format
  • <some_vector>.sbn optional spatial index file

This set of files is often packed into a zip-compressed archive <some_vector>.zip or placed into a unique directory ../<some_vector>/


OpenGIS Simple Features

Simple Features is a widely implemented non-topological standard. The internal data representation of OGR is closely modeled after it, PostGIS is a PostgreSQL implementation and the Spatial Extensions of MySQL implement it too, etc.

The following vector objects are defined:

  • Point
  • LineString
  • Polygon
  • Multipoint
  • Multipolygon
  • GeomCollection




is a non-topological, non-spatial W3C vector format standard. The following vector objects are defined:

  • path: represents the outline of a shape
  • line: a (directed?) line segment that starts at one point and ends at another.
  • polyline: a set of connected straight line segments. typically, it defines open shapes.
  • polygon: a closed shape consisting of a set of connected straight line segments.
  • rect: defines a rectangle shape
  • circle
  • ellipse


Scalable Vector Graphics (SVG) 1.1 Specification


GPS receiver vector data

  • waypoint (WP): point given by its geographic coordinates (usually, user-defined)
  • route (RT) a sequence of waypoints (usually, user-defined)
  • track point (TP) a point given by its geographic coordinates with a time-stamp
  • track (TR) (Lowrance calls it: trail) is a sequence of track points recorded by the GPS receiver during a certain time-interval


GpsBabel performs GPS format and receiver interchange


v.in|out.gpsbabel will be renamed/replaced with v.in|out.gps in GRASS 7.