Skip to content
This repository was archived by the owner on Sep 20, 2024. It is now read-only.

Python API Clip a Raster

Johannes Kolbe edited this page Aug 5, 2014 · 2 revisions

In some cases you might have a big map but only want to focus on a certain part or several parts of it. The method that makes this possible in the Python API of IlwisObjects is called .select(). You can either pass it a Geometry object or directly give it a WKT string, which defines your wanted geometry.

As output the method will give you a new RasterCoverage for further processing.

rc = RasterCoverage("n000302.mpr")

# define e.g. a Polygon with a WKT string
rcSelWKT = rc.select("Polygon((495209 80832,927209 -999367, 1887209 -1282307,2184809 311232,495209 80832))")

# get an existing geometry or make a new one
geom = Geometry("Polygon((495209 80832,927209 -999367, 1887209 -1282307,2184809 311232,495209 80832))", rc.coordinateSystem())

rcSelGeom = rc.select(geom)

Clone this wiki locally