Monday 26 October 2015

arcgis desktop - Using polygons to apply unique value to all raster cells within those polygons?


In ArcGIS 9.3, I have a raster file that I would like to "mask" with polygons, giving a single value to all the raster cells that overlap the polygons.


How can I do this?


Here's a screen shot, where the black polygons are my polygon layer, and the rest is raster-based.


enter image description here



Answer



You can use a conditional statement. The issue with previous recommendations is that when you rasterize your polygons (which is necessary) the background, that does not contain polygons, will be NoData resulting in corresponding areas in the output also being NoData. You will need to set your analysis extent to your original raster and then set a background value (i.e., 0) to the rasterized polygon raster using SetNull. Once you have done this a conditional statement in the raster calculator will look something like this.


Con("praster" > 0, "praster", "OrgRaster")


"praster" is your rasterized ploygon feature class, with a background value of 0, and "OrgRaster" is the raster you wish to modify. This statement is saying that if praster is greater than 0 then assign values from praster else assign values from OrgRaster.


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...