I am using QGIS 2.18.2. I would like to calculate the Euclidean distance from the pixels in a raster to a single Shapefile GPS point. My raster is a Geotiff DEM with a pixel size of 3.856 meters by 3.856 meters. My Shapefile point contains just spatial coordinates and no other attribute information.
I am aware that this type of problem is not new. I've reviewed a number of posts on this topic, and one would think that this would be a no-brainer for me, but unfortunately, I'm still unable to work out the problem(s) in my workflow.
This post summarizes the workflow that I am attempting to do: Calculating distance to points in QGIS. My understanding is that I need to:
- Add a new field to the attributes table of the Shapefile point (I call this new field "Value" and set it to 1), then go Raster-->Conversion-->Rasterize to convert the Shapefile point to a raster.
- Using the result of step 1 as the input, go Raster-->Analysis-->Proximity to generate a raster of distances from the point.
I get stuck on step 1. I have tried a multitude of GDAL command sequences for Rasterize (with reference to http://www.gdal.org/gdal_rasterize.html), but output from this program either includes NAN or is not generated at all.
Here is my DEM and my GPS point at the start:
My (latest) GDAL command line code for Rasterize is as follows:
gdal_rasterize -burn 1 -tr 3.856 3.856 -te 317595 4903986 328357 4911219 -l point E:/point.shp E:/point.tif
After running this Rasterize command , which reportedly finishes without error, I end up with this:
The result is called RasterTx in the Layers Panel on the left. Note that the lower threshold is NaN (black) and the upper threshold is 0 (white). This result doesn't make sense to me, because I would expect to have NaN for all pixels in the square except for the one pixel in which I have my point, which should be assigned a value of 1, per the "burn" command I gave in the GDAL code above. Furthermore, when I proceed to step 2 and attempt to run the Proximity program, the result yields only NaN, so my suspicion is that I'm still missing something wit the Rasterize step.
Where might I be going astray?