I've got a vector grid with a cell size of 4129,24 m x 4129,24. Every cell has an integer value called numpoint. I want to create a raster and continue working with it since the grid is very big and it makes no sense storing these data as vector data. I need the raster to align exactly with my vector grid.

Now I used gdal Rasterize (with the QGIS Processing Toolbox Interface) to rasterize the data. This works fine. Here is my input:

gdal_rasterize -a NUMPOINTS -ot Float32 -of GTiff -te 5834437.693 
3586821.37347 7225991.573 4557192.77347 -tr 4129.24 4129.24 -co 
COMPRESS=DEFLATE -co PREDICTOR=1 -co ZLEVEL=6 -l UCDP_total_vectorgrid_4129m 
"D:\\MyPath\\UCDP_total_vectorgrid_4129m.shp" "[temporary file]"

-te corresponds to the extent I want, -tr defines my resolution, and everything works just fine:

Raster perfectly aligned

Since I've got a lot of vector grids, I wanted to do the same thing using the batch mode of gdals Rasterize (right click, execute as batch process in the processing toolbox): Here are the settings:

Configuration of batch processing

The extent is not fully readable, but it is: 5834437.693,7225991.573,3586821.37347,4557192.77347. (The same values as used above, entered by QGIS according to the raster extent)

Now the result does not align with my vector grid:

raster not aligning

So as far as I can see, I did the same thing, once as a batch process and once using the QGIS GUI, and got different results. Any ideas?

ah, yes, the CRS was the same for all layers.

  • Is the offset between the grid and raster constant across space? Is the upper-left corner (or any..) aligned correctly? – Logan Byers Nov 29 '17 at 21:09

Your Answer

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

Browse other questions tagged or ask your own question.