2

I am trying to rasterize a bunch of vector based shape files in QGIS. All these files are covering certain types of ground use in a city (houses, street, open field,...).

I need these files to be rasterized because I will be running an algorithm on them to determine the least cost path. And for this I need them to be rasterized with a certain fixed pixel size (1m x 1m in the real world). My vector files are 6 km x 10 km but when I rasterize one of the files (for ex: railroads) which isn't reaching over the total 6 km in x direction and over the 10 km in y direction but only over the first 3 km x and 10 km y, the rasterized file is also only 3 km x 10 km.

Somebody any idea how to solve this? Because in this manner, when I choose a pixel size of 6000 + 10000 I'll get pixels with a size of 0,5 m x 1 m in stead of 1 m x 1 m.

2

I assume that you are using the GDAL Rasterize (vector to raster) tool. Using QGIS, you can edit the gdal rasterize command and had the "xmin ymin xmax ymax" parameter:

enter image description here

Notice that you will have to adapt the coordinates to fit your case.

You can use this same command directly on the console or terminal to bash rasterize all your vector in one go.

You can also use v.to.rast.attribute GRASS tool that is available in processing. It will let you use some layer's bounding box as the output region (GRASS region extent... > Use layer Extent).

enter image description here

3
  • Can you tell me how to do this? "You can use this same command directly on the console or terminal to bash rasterize all your vector in one go." How can I provide terminal or the console with information which files to convert? May 10 '14 at 9:45
  • What is your operating system? May 10 '14 at 10:56
  • OSX. When I run the following code I get a syntax error, any idea why? gdal_rasterize [-b 1] [-burn 255] [-te 170000.2 168000.27 177999.8 177999.8] <Adp322.shp> <\Users\PeterVanvoorden\Desktop\work.tif> The same for this one: gdal_rasterize [-b 1] [-burn 255] [-te 170000.2 168000.27 177999.8 177999.8] <Adp322.shp> <work.tif> May 10 '14 at 11:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.