2

I'm trying to use the proximity tool to create a distance raster from a single vector point. I found here: Calculating distance to points in QGIS and [d-3] Create Proximity Raster. However, I couldn't go past the first step which is rasterizing the vector point layer.

I couldn't figure out how to rasterize the single point and extend the raster to a specified distance, like a buffer, and set all the other values to nan or zero. I've tried the different rasterizing tools available in QGIS but I couldn't find anything that works.

  • 2
    GDAL rasterize allows you to use an existing output raster, there's a bit of a hack gis.stackexchange.com/questions/69600/… to create an empty raster. I think the problem you're having is that the output extent can't be set as you've only got 1 point... you could also try buffering the point, exporting the buffer to raster and then use gdal_calc to create an empty matching raster gis.stackexchange.com/questions/220753/… – Michael Stimson Nov 29 '18 at 6:23
  • Hi Michael, yes you were right. I had trouble converting the single point to a raster. I've also thought of and tried buffering the point and then converting to raster. And I've used raster calc to empty all the values. What I could not figure out is how to bring back the value at the original point location? – strythe Nov 30 '18 at 3:49
  • 1
    GDAL_Rasterize with a target of your freshly emptied raster, as the raster already exists it will be updated with your current point location. Earlier versions of this tool required an existing raster, not being able to create a new raster, that has been fixed but if you supply an existing raster as an output it operates as it did before keeping the integrity of your existing raster. – Michael Stimson Nov 30 '18 at 3:54
  • Hi Michael, thanks for the response. I've managed to do the gdal_rasterize function which overwrites a target raster layer when I used QGIS 2.18. But I was initially using version 3.2 for my project, and I was wondering if the same output could be achieved. According to the gdal_rasterize description here: gdal.org/gdal_rasterize.html, it will only overwrite when some options are not used in the call. But I couldn't figure out how to achieve this from playing around with the parameters, since I could no longer edit the gdal call directly in QGIS 3.2 – strythe Dec 3 '18 at 1:23
  • That's worth asking as a new question. AFAIK nothing has changed with GDAL_Rasterize but if the QGIS 3.2 interface will no longer let you edit the commandline that is a significant fault; there may be some 'trick' to editing the command line but I haven't used 3.2 enough to know. – Michael Stimson Dec 3 '18 at 1:31

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.