I am using ArcGIS 9.2 and I have a simple python script that does the following :

  1. Loop over a polygon feature class (shown in red in the image below)
  2. For each record, create a feature layer to isolate the polygon for the row

  3. Clip a raster (floating point DEM) with the geometry of the polygon feature layer using the Extract By Mask tool

The script works great; however, the clipped raster extents match those of the bounding rectangle of the ENTIRE polygon feature class (all rows). The pixels outside of the individual polygon used as the in_mask_data parameter are NoData values (shown in blue in the image below), so they can be easily dealt with.

I would like to know if it is possible to limit the output raster extents to those of the bounding rectangle of the individual polygon used as the in_mask_data parameter? I looked into the Output Extent environment setting and the MINOF setting is the default and it is supposed to be the intersection of inputs - the input raster and the feature layer in my case).

enter image description here

  • In later versions, you can set the extent to a particular shapefile or feature using arcpy.env.Extent = feature_class_path - it doesn't seem to be documented there, but you could try setting it to the extracted file. Otherwise (and I don't know 9.2, which is why this isn't an answer), you could try manually reading the extents from the extracted file (get feature, read geometry properties, get extent) and then set the value that way. – nicksan Aug 7 '12 at 20:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.