# Vectors and Rasters

## Vectors

**Vector** data provide a way to represent real world **features** within the GIS environment. A feature is anything you can see on the landscape. Imagine you are standing on the top of a mountain. Looking down you can see rock outcrop, crevasses, lakes, tents and so on (imagining you are in Antarctica!). Each one of these things would be a **feature** when we represent them in a GIS Application. This kind of data is often known as **discrete** data (as opposed to continuous, which we will cover later). Vector features have **attributes**, which consist of text or numerical information that **describe** the features.

A vector feature has its shape represented using **geometry**. The geometry is made up of one or more interconnected **vertices**. A vertex describes a position in space using an **X**, **Y** and optionally **Z** axis.

Vectors are most commonly thought of as **points, (poly)lines and polygons.**

<div align="center"><img src="/files/-MTGTwhNV9DSGPPmMIVK" alt="Example of points, lines and polygons"></div>

Where there is only a single vertex, it is referred to as a **point**. Examples are station locations, spot heights and ice core locations

Where there are two or more vertices that do not join up at the start and end, a **polyline** is created. Examples are contours, ship tracks and rivers.

Where three or more vertices are present, and the first and last vertex join up, an enclosed **polygon** is created. Examples include land cover, sea ice extent and rock outcrop.

![Diagram explaining the build of points, lines and polygons ](/files/-MTGbidtKWpLCY92Qm7u)

The scale of vector data is an important consideration. Data is often captured at different scales; data captured in very fine detail might not be suitable for a small scale map (zoomed out) and conversely, data created very roughly or at a large scale, will not be suitable for detailed, large scale work.

An example can be made with the coastline of Antarctica - if you are making a map of the whole of Antarctica, you do not need the most detailed dataset available. However, if you are looking at Ryder Bay for example, you want the most detailed data available. This is sometimes difficult if working in very small regions that have not been well-studied or mapped.

{% hint style="info" %}
&#x20;The Antarctic Digital Database contains two resolutions of data - medium and high. We loosely say that high resolution suits scales more detailed than 1:1,000,000.
{% endhint %}

### Examples of vector data formats

* **Shapefiles**
  * the most common form of vector data within GIS
  * developed and regulated by Esri - proprietary
  * although the term is 'a shapefile', the format actually consists of many different files (between \~3-10), as seen below. You need all of the files for the shapefile to work properly.&#x20;
* **GeoPackages**
  * a newer and less widespread format for vector data, but with many advantages over shapefiles
  * as seen in the screenshot below, they only consist of one .gpkg file
  * it is defined by the Open Geospatial Consortium (OGC) - therefore open and non-proprietary
* **Geodatabases, GeoJSON, GPX, KML, CSV,** and many more...

![An example of how a geopackage and a shapefile appear in windows explorer](/files/-MTpks4SmQKWiE4sdDbt)

## Rasters

Rasters represent data in a different way to vectors. They are a **grid of pixels**, and each pixel ( sometimes called cells) contains a value that represents the conditions for the area covered by that cell. Some examples of typical raster data include satellite imagery, sea ice concentration and digital elevation models (DEMs).&#x20;

![A raster, with its matrix of pixels. Each pixel represents a geographical region and each pixel has a value.](/files/-MTGs01-8ZFJzIAyPqkp)

Raster data is used in a GIS application when we want to display information that is **continuous** across an area and cannot easily be divided into vector features. The examples of vector data that we discussed before (station locations, contours, coastline) would be very difficult to represent as a raster. They *could* be saved as a raster, but it would be a big waste of space for all of the pixels that would contain null data.

* It is sometimes sensible to convert data from vector to raster or from raster to vector, but not very often

Rasters should always be **georeferenced** (they should know their place on the earth's surface). This usually consists of a coordinate for the top left pixel in the image, the size of each pixel in the X direction and the size of each pixel in the Y direction. From this information, the file knows the location of each of its pixels.&#x20;

* Formats for georeferenced rasters can vary. A GeoTiff is a very common format for GIS rasters that has many advantages, but there are many others as well.
* You can sometimes work with non-georeferenced images, for example, old aerial photographs or paper maps that have been scanned. You can add these to your GIS and then manually 'georeference' them by locating common points in the image and in a known dataset.

### Spatial resolution of rasters

Every raster layer in a GIS has pixels/cells of a fixed size that determine its spatial resolution. This becomes apparent when you look at an image at a small scale (first image below) and then zoom in to a large scale (second image).&#x20;

![This image of the McDonald Ice Rumples on the Brunt Ice Shelf looks good at this scale](/files/-MTGuc-IO_LgQRsfNwYY)

![...but when viewed at a large scale, you can see the individual pixels](/files/-MTGv5YxsecBxuP7-tIy)

*(image source: Landsat 8 image, 5th Jan. 2020, courtesy of USGS)*

The cell size of the above image is 30 m. The current highest resolution freely available satellite imagery is 10 m. Very high resolution imagery can be purchased with a cell size of 30 cm!

### Spectral resolution and bands&#x20;

Our eyes can only see RGB wavelengths, but electronic sensors in cameras are able to detect wavelengths that our eyes cannot. Raster images that include data for non-visible parts of the light spectrum are often referred to as multi-spectral images. In GIS, recording the non-visible parts of the spectrum can be very useful. For example, measuring infra-red light can be useful in identifying water bodies.

Because having images containing multiple bands of light is so useful in GIS, raster data are often provided as multi-band images. Each band in the image is like a separate layer. The GIS will combine three of the bands and show them as red, green and blue so that the human eye can see them. The number of bands in a raster image is referred to as its **spectral resolution**.

The bands in a Landsat 8 satellite image are shown below. A normal 'natural colour' image will consist of bands 4, 3 and 2. Different combinations of bands can highlight different things, such as snow or fire. An example of a 'false colour' band combination highlighting a lava lake inside a volcano is shown below. In a natural colour image, the lake is not generally visible.

| Bands                               | <p>Wavelength<br>(micrometers)</p> | <p>Spatial resolution<br>(meters)</p> |
| ----------------------------------- | ---------------------------------- | ------------------------------------- |
| Band 1 - Coastal aerosol            | 0.43-0.45                          | 30                                    |
| Band 2 - Blue                       | 0.45-0.51                          | 30                                    |
| Band 3 - Green                      | 0.53-0.59                          | 30                                    |
| Band 4 - Red                        | 0.64-0.67                          | 30                                    |
| Band 5 - Near Infrared (NIR)        | 0.85-0.88                          | 30                                    |
| Band 6 - SWIR 1                     | 1.57-1.65                          | 30                                    |
| Band 7 - SWIR 2                     | 2.11-2.29                          | 30                                    |
| Band 8 - Panchromatic               | 0.50-0.68                          | 15                                    |
| Band 9 - Cirrus                     | 1.36-1.38                          | 30                                    |
| Band 10 - Thermal Infrared (TIRS) 1 | 10.6-11.19                         | 100                                   |
| Band 11 - Thermal Infrared (TIRS) 2 | 11.50-12.51                        | 100                                   |

*Table from:* [*https://www.usgs.gov/faqs/what-are-band-designations-landsat-satellites*](https://www.usgs.gov/faqs/what-are-band-designations-landsat-satellites)

![A false colour composite image of Saunders Island, highlighting the lava lake. Source: BAS.](/files/-MTH8ANn5AqETl1DmtVC)

Information sources:

* [https://docs.qgis.org/3.16/en/docs/gentle\_gis\_introduction/vector\_data.html](https://docs.qgis.org/3.16/en/docs/gentle_gis_introduction/vector_data.html#)
* <https://docs.qgis.org/3.16/en/docs/gentle_gis_introduction/raster_data.html>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://guides.geospatial.bas.ac.uk/qgis-tutorial/gis/vectors-and-rasters.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
