GME

Geospatial Modelling Environment

clipraster (Clip Raster)

Clips an input raster using a reference data source to define the clip boundary or using user defined coordinates defining a clip rectangle

Description

This tool clips an input raster using a reference data source to define the clip boundary or using user defined coordinates defining a clip rectangle. The clip data source can be a point, polyline or polygon feature data source, or a raster data source. By default the raster is clipped to the rectangle that bounds all of the features in the dataset, or to the boundary of the reference raster layer of the clip layer is a raster. However, if the clip layer contains polygons then you may use the 'extent' option to clip the raster to the bounds of the polygons themselves (this is not the default option - use the extent=FALSE option to clip to polygon boundaries). Clipping to polygon boundaries is much slower than clipping using the extent option.

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.

Syntax

clipraster(raster, clip, out, [extent], [where]);

rasterthe input raster data source
clipthe reference layer to clip to (a vector or raster layer), or the coordinates of the rectangle to clip to (min x, max x, min y, max y)
outthe output raster data source
[extent](TRUE/FALSE) if TRUE, results in a clip to the rectangular envelope containing the input features, whereas if FALSE clips the raster to the polygon boundaries (default=TRUE); if the clip layer is a point or line vector layer, or a raster layer, the clip is always to the rectangular envelope
[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)

Example

clipraster(raster="C:\data\landcov.img", clip="C:\data\fields.shp", out="C:\data\lc_clip.img");

clipraster(raster="C:\data\landcov.img", clip=c(428000, 436000, 5960000, 5970000), out="C:\data\lc_clip.img");


Messages

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

Tips on how to use this interface efficiently  Read more...

Links

Open Source GIS

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