Home » GIS Analysis » How To: Rasterization and Vectorization Conversion

How To: Rasterization and Vectorization Conversion

rasterization vectorization

How is Rasterize Different From Vectorize?

Rasterization converts vectors into rasters. But vectorization transforms rasters into vectors.

We know the two main data models and graphics are vector and raster data. But how do you go from one data model to the other?

That is when you would use rasterization and vectorization. Learn how to do this for free with open source QGIS 3. But first for some basics:

What is a Vector?

Vector data are composed of vertices and paths. For example, the three types of vectors are points, polylines, and polygons.

Vector points are simple XY coordinates in geographic space.

Point Vector Data Type

Polylines connect XY coordinates called vertices with paths.

Vector Data Type Line

Lastly, vector polygons are a set of closed vertices and paths.

Vector Data Type Polygon

And we often store these points, lines, and polygons in shapefiles, geodatabases, and various other GIS file formats.

What is a Raster?

Unlike vector data, rasters are made up of pixels or grid cells. Further to that, they are usually regularly spaced and square (but they don’t have to be) and often look pixelated.

Discrete rasters are categorical and have distinct values identifying each cell. For example, a land cover raster might represent urban as the value of 1 and forest as 2.

Discrete raster

Continuous rasters are grid cells with gradually changing data such as elevation, temperature, or an aerial photograph. Continuous data is also known as non-discrete or surface data.

Continuous raster

READ MORE: 15 Free Satellite Imagery Data Sources

Rasterization: Convert Vector to Raster

In this example, we are going to use the open source program QGIS.

Unlike graphic editing software, it expects your rasters and vectors to have a geographic coordinate system. But really it has similar functionality to Adobe Photoshop or GIMP that you can perform for rasterization and vectorization.

Let’s start with a simple vector line with a vertex at the start and endpoints.

vector line

Use the Rasterize (Vector to Raster) Tool. The horizontal and vertical parameters will determine the output pixel size. After setting all the parameters, click “RUN” for rasterization.

rasterized line

Finally, the output will look like a gridded version of your vector. Depending on the pixel size you set, you may have to do some trial-and-error for better results.

Vectorization: Convert Raster to Vector

Let’s go in reverse this time and take a discrete raster and convert it to a vector.

When we have a raster data set like our buildings layer, it’s a matter of adding it to QGIS. Here’s what the raster buildings look like in the table of contents:

raster buildings

QGIS comes loaded with algorithms and plugins for you. Further to this, other providers like GRASS GIS, SAGA GIS, and Orfeo Toolbox bring additional firepower to the table.

Double-click the tool and select the raster that you want to convert to vector. From here, you’ll have to select the output of the raster to a point, line, or polygon. After clicking “Run”, the vectorized raster will appear in the table of contents.

vectorized buildings

As a reminder, vectorization creates all the necessary vertices and paths as shown with the building outlines. In a nutshell, this tool digitizes the raster for you to convert it to a vector.

If you want to learn how to vectorize a continuous raster, this will take a bit of effort to reclassify cells essentially grouping them into discrete forms. Using a temperature raster as an example, when you group values from [-37.8 to 0] as 0 and [0 to 37.7] as 1, you are turning it into a discrete raster. From here, you can follow these same steps for vectorization.

READ MORE: 10 Free GIS Data Sources: Best Global Raster and Vector Datasets

Rasterization and Vectorization

For the most part, it’s a basic process to vectorize or rasterize images.

Rasterization refers to converting vectors into rasters. While vectorization transforms rasters into vectors.

These are the essential steps on how to go from one data model to another.

Any questions? Let us know below.

Subscribe to our newsletter:

5 Comments

  1. Great article! The explanation of the differences between rasterization and vectorization was very clear and easy to understand. I especially appreciated the use of illustrations and examples to further explain the concepts. This article will definitely be a useful resource for anyone looking to learn more about the topic. Thanks for sharing!

Leave a Reply

Your email address will not be published. Required fields are marked *