Geospatial Modelling Environment

cliprasterbypolys (Clip Raster By Polygons)

Clips an input raster to each polygon in a polygon data source resulting in one new raster per polygon


This tool clips an input raster using the polygons in a polygon data source. The command cycles through each polygon, clips the raster if there is overlap, and writes one new raster image per polygon. The extent of the new raster is the intersection of the extent of the polygon and the extent of the raster.

This tool is designed to work with these three raster formats: grids, TIFF/GeoTIFF, and ERDAS Imagine rasters. Note that not all raster formats support all datatypes. When you are clipping a raster it is recommended you consider two strategies to avoid these pixel data type problems: 1) ensure the output format matches the input format, or 2) always use the Imagine img format as the output format as this supports all the data types. The output format is specified by adding the appropriate file extension to the file name. No extension is interpreted as the grid format, the ‘.tif’ extension is the GeoTIFF format, and the ‘.img’ extension is the Imagine format.

Note that all clips will preserve the cell alignment of the input raster (no shifting of pixels will occur at all). However, the display properties of the input raster are not transferred to the output raster, so if you are clipping digital photos or satellite images you should expect the appearance of the clipped images to differ from that of the original image.


cliprasterbypolys(raster, poly, uidfield, out, [format], [prefix], [where]);

rasterthe input raster data source
polythe input polygon data source
uidfieldthe unique ID field of the input feature data source
outthe output folder to which the raster clips will be written
[format]the output raster format (default=GRID; options: GRID, TIF, IMG)
[prefix]the prefix to be used to name the clipped rasters, and to which the unique ID value of the polygon is appended as the suffix; note that for Grids the name cannot exceed 14 characters (default=”clip”)
[where]the selection statement that will be applied to the feature data source to identify a subset of features to process (see full Help documentation for further details)


cliprasterbypolys(raster=”C:datalandcov.img”, poly=”c:datafields.shp”, uidfield=”FLDID”, out=”C:datalc_clips”, format=”IMG”);

cliprasterbypolys(raster=”C:datalandcov.img”, poly=”c:datafields.shp”, uidfield=”FLDID”, out=”C:datalc_clips”, prefix=”FLD_”, format=”GRID”, where=”FLDID < 100″);


Please consider making a purchase to support the continued development of these tools  Read more...

Tips on how to use this interface efficiently 


Open Source GIS

Copyright © 2001-2014 Hawthorne L. Beyer, Ph.D., Spatial Ecology LLC    Connect on LinkedIn