I have a large raster created from values that cover the whole United States and Alaska which are both polygon and polyline features, this raster was caluclated using Spatial Analyst IDW Interpolation. How can I get the raster to clip with the either the polyline of the United States border or the polygon shape of the United States?alt text

I followed the advice of @DerekSwingley and set the cell size environment setting to match the original raster. It gives it a smooth border but instead of having smooth grades of differentiating colors now i have large blocks of differentiating colors.


alt text


alt text

Any ideas on how I can fix this and get the Bad raster to look like the orignial (good) raster but keep the bad rasters border?

3 Answers 3


Use Extract by Mask which:

Extracts the cells of a raster that correspond to the areas defined by a mask.

and specify your polygon feature class of the US as the mask.

  • Tried this but it severely killed the resolution of the raster, any way to keep the original res?
    – Furlong
    Dec 21, 2010 at 0:03
  • 2
    What's the cell size of the raster being clipped? You could also try setting the cell size environment setting for ArcGIS: help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//… Dec 21, 2010 at 1:25
  • You are absolutely correct. In some cases the result will be sensitive to the grid origin, too, so a better approach is to set the origin and cellsize to the same as the interpolated grid. Actually, in retrospect it's best to establish the desired projection, specify an explicit raster environment at the outset, create the mask first, and then do the interpolation with the mask in place: that would be easier for both the analyst and the computer.
    – whuber
    Dec 21, 2010 at 14:48

With GRASS GIS you could rasterize your polygone of the USA (v.to.rast) and then use a mask.


You can also use the GDAL utility program GDALWarp - http://www.gdal.org/gdalwarp.html

Passing in a -cutline parameter (a feature from any OGR datasource) clips the original raster.


C:\gdal\apps\gdalwarp C:\myraster.tif C:\output.tif -cutline C:\inputfeat.json -dstnodata -9999

In GDAL 1.8 there is a new -crop_to_cutline paramter that may also be useful.

  • 1
    only problem with this -cutline parameter is that the resulting raster comes with a mislocation of ~1 pixel... Jul 14, 2011 at 14:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.