Clip Raster with a Rectangle


This sample tool allows you to clip a portion of raster by drawing a clipping rectangle in ArcMap or specifying the cooridinates of the clipping rectangle in either map space or image space.

How to use:
  1. Start ArcMap, click Tool/Customize/Add from file, then add this dll.
  2. In the Customize dialog, click Commands tab, then click Raster Sample Tool in the Catergories list.
  3. Drag the command "ClipRaster" to any toolbar.
  4. Add a raster layer into ArcMap, draw a clipping rectangle and choose "Graph" clipping type.
  5. Or choose File or Map clipping type, then input the coordinates of the clipping rectangle.


Difficulty: Intermediate

Visual Basic
File Description
ClipRaster.bas Module file that defines some functions.
ClipRaster.cls Class module file that clips the raster.
ClipRaster.frm Form that exposes the interface for clipping a raster.

Key CoClasses: Raster, RasterLayer, RasterDataset
Key Interfaces: IRasterLayer, IRasterProps, ICommand, IRasterDataset