2

I have a point data layer (vector) that I converted to a raster layer. I want to replace the NoData value (between each raster point) in the point raster layer by 0. So, I made a background raster layer (value = 0).

My plan was to add the background layer of 0 to the point raster layer, but as we can see in the + (Addition) tool page, a number (0) + NoData = NoData.

Any tips on how to achieve this?

I'm using ArcGIS 10.3, but I also have access to QGIS 2.10.

EDIT : I saw the QGIS Raster Calculator: Need values to be set to 0 instead of no data question, but I can't find the "Reclassify grid cells" tool. I just have "Reclassify grid values".

enter image description here

2

The simplest and fastest way to replace NODATA with something else, is map algebra/raster calculator:

enter image description here

It works on float and integer rasters. It is a good idea to specify type of output raster explicitly, using built-in functions Int or Float

1

The Reclassify tool in ArcMap 10.3 (Spatial Analyst > Reclass > Reclassify) enables you to reclassify No Data to another value. Now, this might not work for you if you have No Data values in your output sum image that you don't want to reclassify as 0. There are ways around this issue, but if you are OK with turning all of your No Data value to 0 then the Reclassify is a straightforward way to solve this.

  • I already thought of that, but the problem is that I only want to change the No Data and leave the rest intact. My point data has a lot of unique values and Reclassify works in range. – Nahas Oct 23 '15 at 18:58
  • Ok, here is an idea for a work around: Add a field to your point data that indicates it is an instance of summing Zero with No Data. You could do this with spatial join if you are familiar with that tool. Then, select those points by attributes (e.g. WHERE '0 Plus No Data' = TRUE) and then run the Reclassify tool. – Charlie Parr Oct 23 '15 at 19:07
1

One option is to change the nodata value in your raster, then remove the nodata flag. This is probably fastest with gdal. For example, if your nodata value is -9999:

gdalwarp -dstnodata 0 input.tif output.tif
gdal_edit.py -a_nodata -9999 output.tif

gdalwarp has rewritten all your nodata cells to value 0, and changed the nodata flag to 0. gdal_edit.py has changed the nodata flag back to -9999, leaving the pixels untouched. The 0 pixels are now valid.

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.