I am having some trouble getting gdalwarp to work. I want to clip my input raster in.img to the boundary of a polygon stored in a shapefile polygon.shp and save it out as out.img. The data type of in.img is 32-bit float. The raster cells external to the polygon delineation have a value of 0.0. I figure gdalwarp ought to be able to clip in.img to my polygon boundary, effectively setting the external 0.0 values to NoData (that is what I want to do, anyway). I am using the following command at the Windows command prompt:
gdalwarp -of HFA -cutline polygon.shp in.img out.img
The problem is, this doesn't seem to achieve anything. out.img is essentially a copy of in.img in that the cells external to the polygon boundary are still 0.0—my understanding was that this would only happen if I used the -crop_to_cutline flag.
What am I doing wrong?