# Vectors: a type of representation of real world in the GIS field

Often, who is beginner in GIS field have some difficult to understand what the vectors are. But this is one of most important things to understand into the GIS field.

In mathematic sciences, a vector space (also called a linear space) is a collection of objects called vectors, which may be added together and multiplied (“scaled”) by numbers, called scalars. Scalars are often taken to be real numbers, but there are also vector spaces with scalar multiplication by complex numbersrational numbers, or generally any field. The operations of vector addition and scalar multiplication must satisfy certain requirements, called axioms, listed below.

Euclidean vectors are an example of a vector space. They represent physical quantities such as forces: any two forces (of the same type) can be added to yield a third, and the multiplication of a force vector by a real multiplier is another force vector. In the same vein, but in a more geometric sense, vectors representing displacements in the plane or in three-dimensional space also form vector spaces. Vectors in vector spaces do not necessarily have to be arrow-like objects as they appear in the mentioned examples: vectors are regarded as abstract mathematical objects with particular properties, which in some cases can be visualized as arrows. From Wikipedia

In computer science, an array data structure, or simply an array, is a data structure consisting of a collection of elements (values or variables), each identified by at least one array index or key. An array is stored such that the position of each element can be computed from its index tuple by a mathematical formula.[1][2][3] The simplest type of data structure is a linear array, also called one-dimensional array. From Wikipedia

Vector graphics are computer graphics images that are defined in terms of 2D points, which are connected by lines and curves to form polygons and other shapes.[1] Each of these points has a definite position on the x- and y-axis of the work plane and determines the direction of the path; further, each path may have various properties including values for stroke color, shape, curve, thickness, and fill. From Wikipedia

There is a line that join the three types of vector that we have seen earlier. Let me show this!

The code lines reproduce a geojson that came from PostGIS. If you look at the line 5 you can see, after “coordinates”, the typical formatation of mathematic vector. Every couple of coordinates [ 12.158822824152232, 47.583995291616759 ] defines the geographical position of a point; in this case the point is called(“fid”) 1. The vector have 3 points because it have 3 couple of coordinates. This vector is bidimensional because there are only 2 coordinates for a point instead of the 3 necessaries for a tridimensional vector.

What else show to us this code lines? On line 3 there is a coordinate reference system(do you remember the coordinates in Euclidean space?). On line 5 the attribute “geometry” define a type of geometry: a point in this case, but we could have a polygon or a line(with this we joined to the computer graphics).

After this little, but very important, introduction we can define what is a vector for the GIS field:

A vector is a collection of coordinates expressed with one of the type of geometrical primordial, that define an object that represent a geographical entity or a type of natural or unnatural phenomenon.

The objects called geometrical primitives are points, lines and polygons; every vector must be have only one type of geometrical primitives.

Fig.1 – Point Vector: trees positions

Fig.2 – Polygon Vector: buildings occupancy areas

Fig.3 – Line Vector: municipality border

Figures 1 and 2 show us geographical entities, figure 3 reproduce an abstracted geographical entity as a municipality border.

Everyone of this typology of vectors include a lot of informations. In fact, every geometric vector have a lot of information, called attribute, saved in a table called attribute table. The attribute table is one of a series of things that divide GIS vector from CAD vector.

When we difine a geometrical vector in PostGIS, using SQL, we call the command AddGeometryColumn. With this command we define the type of the vector (POINT, LINESTRING, POLYGON, MULTIPOINT). A client as QGIS will to read always one type of geometry column also when in a vector there are two or more type of geometry column.

Another thing that create confusion in who is beginner in GIS field is the nomenclature. There are many type of vector formats: Geojson, Shape File, GPX, Kml; all of these are vectors. When “we don’t see” the extention becouse the vector is into a geodatabase, if we going in the DBMS we can see wich type of vector it is; still point, line or polygon.

Fig.4 – Geometrical vectors layers in overlay