eyecatch

GIS Data Basics: Vector vs. Raster Data

Published: Last updated:

What you'll learn


  • What vector data and raster data are
  • File formats for GIS data
  • How to choose between vector data and raster data

Recommended for


  • Anyone getting started with GIS
  • Anyone who wants to learn about the data GIS works with

Introduction

This article is for GIS beginners. It introduces vector data and raster data, the two types of data used in GIS, and describes how their data formats differ.

Vector data and raster data

GIS data falls into two broad types: vector data and raster data.

Vector data represents shapes such as points, lines, and polygons using the coordinates of their vertices. Raster data, on the other hand, is represented by a grid of pixels.

The difference between vector and raster representations (created by the editorial team)
The difference between vector and raster representations (created by the editorial team)

The sections below explain each type in more detail.

What is vector data?

Vector data represents geospatial information as shapes such as points, lines, and polygons. Vector data shapes fall into three types.

Point
A point is the most basic geometry, marking a specific location in geographic space. It is defined by coordinates in 2D space (x, y) or 3D space (x, y, z), and marks a single location with no spatial extent or length.

Points represent specific locations, such as intersections, street trees, utility poles, and stores.

Line (polyline, linestring)
A line is a geometry formed by connecting two or more points. It is built by linking multiple vertices. A line has a start point and an end point, and it has length.

Lines represent things that form a continuous connection, such as railways, roads, rivers, and power lines.

Polygon
A polygon is a geometry in which the line connecting the vertices forms a closed shape. It has at least three vertices, and its start point and end point are the same point, which closes the shape. A polygon represents a specific region and has an area.

Polygons represent things that cover an area, such as land parcels, the shapes of buildings, lakes, and ponds, and municipal boundaries.

An illustration of the points, lines, and polygons that make up vector data (created by the editorial team)
An illustration of the points, lines, and polygons that make up vector data (created by the editorial team)

Whether you use a point, a line, or a polygon for the same geospatial information depends on your purpose.

For example, you can show a building either by its outline as a polygon or by its location as a point.

With polygon data, you can run area-based analysis, such as calculating the site area of a building or extracting the information inside an area. With point data, you can use the locations as the start and end points of a route search, or analyze the relationships between points (for example, with Voronoi diagrams).

In this way, you choose which data to use based on your purpose, such as how you want to represent things and what analysis you want to run.

The same building represented as a polygon (left) and as a point (right) (created by the editorial team)
The same building represented as a polygon (left) and as a point (right) (created by the editorial team)

Attributes in vector data

Vector data is distinctive in that each feature can have attributes (information).

For example, the attributes of a building include its name, address, and number of floors. In GIS, you can update attributes and add more fields as needed.

This lets you manage, search, and analyze information about a specific feature together with its location on the map.

An illustration of the attributes (information) a feature holds. A building feature is linked to information such as its name and address (created by the editorial team)
An illustration of the attributes (information) a feature holds. A building feature is linked to information such as its name and address (created by the editorial team)

In GIS software, you can view attributes in the attribute table.

The attribute table displayed in QGIS (created by processing Fundamental Geospatial Data from the Geospatial Information Authority of Japan (GSI))
The attribute table displayed in QGIS (created by processing Fundamental Geospatial Data from the Geospatial Information Authority of Japan (GSI))

What is raster data?

Raster data is data made of pixels arranged in a grid.

Another characteristic of raster data is that you can see the grid when you zoom in on the map. The size of each pixel is called the pixel size, or resolution. The smaller the pixel size, the finer the information the data can represent, but the larger the data becomes.

Raster data is composed of pixels arranged in a grid (created by processing Global Map Japan from GSI)
Raster data is composed of pixels arranged in a grid (created by processing Global Map Japan from GSI)

Raster data is used for image data such as aerial photographs and satellite data, and for data with continuous values such as elevation. Even when it covers a wide area, raster data keeps the data size smaller than vector data, so it is often used for basemaps.

Examples of raster data (created by processing Global Map Japan from GSI on the left, GSI Tiles in the center, and GCOM-C (©JAXA) on the right)
Examples of raster data (created by processing Global Map Japan from GSI on the left, GSI Tiles in the center, and GCOM-C (©JAXA) on the right)

Attributes in raster data

In raster data, each pixel stores an attribute (a value).

The values can be real numbers, such as elevation values, or numeric codes that stand for information. In land use data, for example, built-up land might be stored as “10” and water as “50.” Aerial photographs and satellite images store RGB values as pixel values.

GIS displays the raster in color on the map by assigning each pixel a color based on its value.

Examples of the values a raster stores. (Left) To represent elevation, the raster stores actual elevation values. (Right) To represent land use, it stores numeric codes.
Examples of the values a raster stores. (Left) To represent elevation, the raster stores actual elevation values. (Right) To represent land use, it stores numeric codes.

File formats

Vector data file formats

Vector data comes in several different file formats for use in GIS.

You choose among these file formats depending on the purpose, the type of data, and software compatibility. Here are some representative vector data file formats.

Shapefile (extensions .shp, .dbf, .shx, and others)
A representative GIS data format introduced by Esri. A Shapefile consists of multiple files, and the data does not open correctly unless all the required files are present.

The table below lists the main files that make up a Shapefile.

Extension Description Required?
.shp The main file that stores geographic shapes (geometry). It contains shape information such as points, lines, and polygons. Required
.shx The shape index file. It holds index information for the geometry in the .shp file. Required
.dbf The file that stores attribute data. It uses the dBASE format and holds the attribute information for each geometry. Required
.prj The file that stores information about the coordinate reference system (CRS). Optional
.cpg The file that defines the character encoding of the attribute data. Optional

The .shp file records geometry, the .dbf file records attributes, and the .shx file links the two. The .prj file records CRS information.

This structure lets software read and edit the data efficiently. It also has drawbacks: the files are cumbersome to manage, and there are limits on file size and on the names of attribute fields.

When these files are stored in the same folder, they work together as a single dataset, a Shapefile. To add a Shapefile to QGIS, put the files in the same folder and load only the .shp file.

Multiple files stored in the same folder work together as a Shapefile
Multiple files stored in the same folder work together as a Shapefile

Note that a Shapefile needs at least three files to work correctly: .shp, .shx, and .dbf.

GeoJSON (extension .geojson)
A file format based on JSON. It is lightweight and easy to read, so it works well with web systems. However, processing slows down with large amounts of data.

GeoPackage (extension .gpkg)
An open GIS data format standardized by the Open Geospatial Consortium (OGC). A GeoPackage is a file that can store raster data as well as vector data.

This makes data easy to manage, and the file compresses efficiently, giving strong performance. On the other hand, because the format is relatively new, older GIS software may not support it.

Raster data file formats

Raster data exists as ordinary image files, such as .tif (TIFF image), .png (PNG image), and .jpg (JPEG image). Because these files store values in a grid, you can think of them as “image files with location information.”

However, an image that has no location information does not appear in the correct place when you load it into GIS. You can add location information to such an image file. This process is called “georeferencing.”

Some image files can store location information in the file header. Others record it in a separate file.

Conclusion

GIS data comes in two types: vector data and raster data. Vector data is expressed as shapes such as points, lines, and polygons. Raster data stores numeric values in a grid, like an image.

Vector data file formats include Shapefile, GeoJSON, and GeoPackage. Raster data file formats include TIFF and PNG image files.

About the author
QGIS LAB Editorial Team
QGIS LAB Editorial Team

QGIS LAB is a comprehensive information hub for QGIS, the open-source GIS software. Under the concept of “Geospatial for Greater Good,” we share the knowledge and skills to open up the world through location data.