1

I have long tried to rasterize a point shapefile with the same resolution (32.461 km) as another raster layer I have loaded into the QGIS canvas too.

example

I have seen multiple cases, here and here where they suggest the GDAL rasterize tool in QGIS. However, in the tool they describe, I can set an input raster. This is nowhere to be found in the QGIS 3.4 Madeira version. rasterize sample

So how can I then make sure to rasterize my shapefile with the same resolution as the underlying raster layer?

EDIT:

I have tried to set the pixels and the extent of the new raster layer equal to the loaded raster file. So I get this:

Pixel Size 32.46300147045617734,-32.46300031136775033

Extent -5645.5752507352281100,-4626.0776915619335341 : 5684.0122624539781100,4366.1733946869335341

test

But there is no raster layer appearing on the canvas, even after reprojecting it.

EDIT EDIT: Okay okay(!) I get something now, but when I put the pixels the size of the raster layer, I end up with a lot larger pixels than first hoped, see below:

rasterized_wrong

Why?

5
  • You could create an empty copy from the reference raster and then use gdal_rasterize directly to burn vectors into this template. About how to create the empty copy read gis.stackexchange.com/questions/220753/…
    – user30184
    Dec 1 '20 at 12:54
  • Have you made sure there are no special signs in path and file names? Have you checked if the colour ramp simply needs fixing/stretching?
    – Erik
    Dec 1 '20 at 12:57
  • Yes, there is nothing wrong with the path, I have doubled checked now. It seems like I get nodata pixels out of my rasterization.
    – Thomas
    Dec 1 '20 at 13:00
  • Your burn value is 0. Could it be that your nodata value it 0 as well? Try to burn with white 255 or perhaps middle grey 128.
    – user30184
    Dec 1 '20 at 13:02
  • What is the native CRS of your vector data and is it the same for the raster?
    – user30184
    Dec 1 '20 at 13:33
2

Yes there is. Press the triple buttons next to output extent. then Extent from Layer->select your layer. Now make sure your resolutions match. (sorry, there's no way to get that from the other raster, you can inspect it and copy values) and you're done!

Also, why not upgrade to the latest LTS release? (3.14 A Coruña)

9
  • This does not help me. I set the pixels to be 32.463 as the raster layer pixels, and the extent to be my raster layer extent. The result is nothing. It computes it, but nothing appears on the canvas. Even after reprojecting.
    – Thomas
    Dec 1 '20 at 12:40
  • that's another problem... Is there a nodata raster created? (that happens when GDAL encounters a problem) Did you specify the field for a burn-in value? Dec 1 '20 at 12:46
  • Yes, I set the burn-in value to my temperature field in the shapefile, I'll edit it into my question, thanks.
    – Thomas
    Dec 1 '20 at 12:49
  • And, the rasterized values are completely off (see Layers in additional picture). I have temperature values of around 250 to 300 something, but now I am dealing with values of x+e308!
    – Thomas
    Dec 1 '20 at 12:54
  • That's a nodata pixel Dec 1 '20 at 12:56

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.