본문 바로가기
English Guidance/QGIS Basics

[QGIS Basics] File Conversion (Raster -> Vector)

by CaptainJ 2024. 4. 8.
반응형

Hello,

In this post, we'll delve into the most fundamental aspect of file conversion, even among the basics.

 

 

 

Fundamentally, vector files and raster files can be converted between each other, allowing rasterization (vector to raster) and polygonization (raster to vector).

 

Often in GIS tasks, there are functionalities that can only be applied to vector layers, and conversely, there are functionalities that only work on raster layers. In such cases, the rasterize and polygonize functions can be quite useful.

 

However, for large files with a lot of information, conversion can take a considerable amount of time and may even cause lag in the software, so blindly converting file extensions may not always be the most efficient choice.

 

Usually, spatial boundary maps, including administrative boundaries, are available in vector files. If you have a raster file for administrative boundary maps instead of a shapefile, applying styles and visualizing the map itself may not be a problem.

 

However, it could become problematic if you need to use functionalities like Zonal Statistics (for more details, refer to the following link:  https://qgis-jaehee.tistory.com/16), which requires spatial information to be in vector layers.

 

The Zonal Statistics function can only be utilized when spatial information is in vector layers.

 

Now, let's take a concrete look at how to convert between vector and raster files through the example below.

First, let's download the administrative boundary map of Papua New Guinea from the website below, which provides border data in tif format:

https://hub.worldpop.org/geodata/summary?id=24680

 

WorldPop :: Administrative Areas

The dataset is available to download in Geotiff format at a resolution of 3 arc-second (approximately 100m at the equator). The projection is Geographic Coordinate System, WGS84. Grid cell values represent incremental, globally unique, numerical identifier

hub.worldpop.org

 

Please drop the downloaded file onto the QGIS main screen.

You can confirm that a faint map has been imported, as shown below.

 

 

 

Now, from the top menu bar, navigate to Raster > Conversion > Polygonize (Raster to Vector).

 

 

 

When the window pops up, select the Input layer as png_subnational_admin_2000_2020, then click the "Run" button.

 

 

It takes quite a bit of time to convert even for small countries.

 

I remember leaving the program running overnight when working on the entire East Asian region.

 

After waiting for a few minutes and closing the completion message window, you'll find a new layer named "Vectorized" has been added, as shown below.

 

 

 

The raster file has been converted to a vector file.

In the next post, we'll explore the method of "Raster to Vector" conversion.

 

 

 

Thank you!

반응형

댓글