Spatial Data Types: Raster vs Vector

Spatial data observations focus on locations.

Every house, every tree, and every city has its own unique latitude and longitude coordinates.

The two primary types of spatial data are vector and raster data in a GIS. But what is the difference between raster and vector data?

When should we use raster and when should we use vector features? Find out more about the spatial data models commonly used.

Vectors models are points, lines, and polygons

Vector data is not made up of a grid of pixels. Instead, vector graphics are comprised of vertices and paths.

The three basic symbol types for vector data are points, lines, and polygons (areas).

Because cartographers use these symbols to represent real-world features in maps, they often have to decide based on the level of detail on the map.

Points are XY coordinates

Point Vector Data Type

Vector points are simply XY coordinates. Generally, they are latitude and longitude with a spatial reference frame.

When features are too small to be represented as polygons, points are used.

For example, you can't see city boundary lines on a global scale. In this case, maps often use points to display cities.

Lines connect vertices

Vector lines connect each vertex with paths. Basically, you're connecting the dots in a set order and it becomes a vector line with each dot representing a vertex.

Vector Data Type Line

Lines usually represent features that are linear in nature. For example, maps show rivers, roads, and pipelines as vector lines. Often, busier highways have thicker lines than abandoned roads.

On the other hand, networks are line data sets but they are often considered to be different. This is because linear networks are topologically connected elements. They consist of junctions and turns with connectivity.

If you were to find an optimal route using a traffic line network, it would follow set rules. For example, it can restrict turns and movement on one-way streets.

Polygons connect vertices and close the path

Vector Data Type Polygon

When you join a set of vertices in a particular order and close it, this is now a vector polygon feature. When you create a polygon, the first and last coordinate pairs are the same.

Cartographers use polygons to show boundaries and they all have an area. For example, a building footprint has square footage, and agricultural fields have acreage.

Raster Types: Discrete vs Continuous

Raster data is made up of pixels (also referred to as grid cells). They are usually regularly spaced and square but they don't have to be. Rasters often look pixelated because each pixel has its own value or class.

For example:

Each pixel value in a satellite image has a red, green, and blue value. Alternatively, each value in an elevation map represents a specific height. It could represent anything from rainfall to land cover.

Raster models are useful for storing data that varies continuously. For example, elevation surfaces, temperature, and lead contamination.

Raster Cellsize

Raster data models consist of 2 categories – discrete and continuous.

Discrete Rasters have distinct values

Discrete rasters have distinct themes or categories. For example, one grid cell represents a land cover class or a soil type.

Discrete raster

In a discrete raster land cover/use map, you can distinguish each thematic class. Each class can be discretely defined where it begins and ends.

In other words, each land cover cell is definable and it fills the entire area of the cell.

Discrete data usually consists of integers to represent classes. For example, the value 1 might represent urban areas, the value 2 represents forest, and so on.

Continuous Rasters have a gradual change

Continuous rasters (non-discrete) are grid cells with gradually changing data such as elevation, temperature, or an aerial photograph.

Continuous raster

A continuous raster surface can be derived from a fixed registration point. For example, digital elevation models use sea level as a registration point.

Each cell represents a value above or below sea level. As another example, aspect cell values have fixed directions such as north, east, south, or west.

Phenomena can gradually vary along a continuous raster from a specific source. A raster depicting an oil spill can show how the fluid moves from high concentration to low concentration. At the source of the oil spill, concentration is higher and diffuses outwards with diminishing values as a function of distance.

Vector data advantages and disadvantages

What are the advantages of using vector data?

Because vector data have vertices and paths, this means that the graphical output is generally more aesthetically pleasing. Furthermore, it gives higher geographic accuracy because data isn't dependent on grid size.

Topology rules can help data integrity with vector data models. Not only that, network analysis and proximity operations use vector data structures.

What are the disadvantages of using vector data?

Continuous data is poorly stored and displayed as vectors. If you want to display continuous data as a vector, it would require substantial generalization.Although topology is useful for vector data, it is often processing intensive. Any feature edits require updates on topology. With a lot of features, vector manipulation algorithms are complex.

Did you know?
Spaghetti Data Model

The spaghetti data model was one of the first conceptual models to add structure to features in a GIS.

It was a simple GIS model where lines may cross without intersecting or topology without attributes.

What are the advantages of raster data?

A raster grid format is a data model for satellite data and other remote sensing data. For raster positions, it's simple to understand cell size.

Map algebra with raster data is usually quick and easy to perform. Overall, quantitative analysis is intuitive with discrete or continuous rasters.

Map Algebra

What are the disadvantages of raster data?

Because cell size contributes to graphic quality, it can have a pixelated look and feel. To illustrate, linear features and paths are difficult to display.

You cannot create network datasets or perform topology rules on rasters. Also, you don't have the flexibility with raster data attribute tables.

Raster datasets can become potentially very large because they record values for each cell in an image. As resolution increases, the size of the cell decreases. But this comes at a cost for speed of processing and data storage.

Vector vs Raster: Spatial Data Types

It's not always straightforward which spatial data type you should use for your maps.

In the end, it really comes down to how the cartographer conceptualizes the feature on their map.

  • Do you want to work with pixels or coordinates? Raster data works with pixels. Vector data consists of coordinates.
  • What is your map scale? Vectors can scale objects up to the size of a billboard. But you don't get that type of flexibility with raster data
  • Do you have restrictions on file size? Raster file size can result in larger in comparison with vector data sets with the same phenomenon and area.

There are some of the features you have to think about during the data design and conceptualization phase.

Spatial data structures

Spatial data types provide the information that a computer requires to reconstruct the spatial data in digital form.

In the raster world, we have grid cells representing real-world features. In the vector world, we have points, lines, and polygons that consist of vertices and paths.

Vector and raster data both have their advantages and disadvantages.

But don't sweat it:

Because you can convert vector to raster. And vice versa.

Do you have anything to add? Let me know with a comment below.