[GIS] the math behind rasterization

qgisqgis-pluginsraster

I'm taking the first steps in QGIS (version 2.2 Valmiera) and I am having some difficulties in knowing what mathematical criterion that QGIS uses when converting polygons (shapefile) to raster. I'm using a resolution of 100 by 100 pixels.

Commands: Raster – Conversion

What is the percentage that the program uses?When I overlap the shapefile and raster that the information is not 100% coincidental. I understand that the information is not completely coincident, because the raster consists in squares (pixels).

As I understand the raster is a binary system 0 (absence) and 1 (presence of what is to be studied). This "1" corresponds to a square (pixel). what is your percentage?
What is the mathematical mechanism? I'm losing information?


In Figure 4 you can see how the overlap is not complete (marked with circles). What I would like to know which algorithm that QGIS uses the rasterization? What is your standard? Is there a percentage to exclude certain information? I understand that in geometric terms the result of a shapefile is not the same as a raster. For the program to do the rasterization process will have to be a mathematical foundation?

enter image description here

enter image description here

enter image description here

enter image description here

Best Answer

Explained with pictures:

  • Take a polygon
  • Place it on the raster canvas
  • Remove all pixels which are totally outside of the polygon

enter image description here enter image description here enter image description here

  • Select pixels with their centre points lying outside of the polygon.
  • Remove selected pixels
  • What remains is the result of rasterization.

enter image description here enter image description here enter image description here

This is the default behaviour of rasterization in QGIS. However, if the gdal_rasterize command is run with the -at (ALL TOUCHED) switch all the pixels which intersect the polygon will be selected and the result will be as in the third image above where only the totally outlying pixels were removed. The ALL TOUCHED setting should be used with care because it may lead to odd results when the layer that is to be rasterized contains adjacent polygons or other close objects.

Related Question