[Gdal-dev] How to extract sub-image
Norman Vine
nhv at cape.com
Tue May 25 17:47:18 EDT 2004
Clay, Bruce writes:
>
> I know how to open a file and read the bands and thus the data so I can
> get data for a sub-image but I don't see how to create a file of the
> same format that is a particular sub-image of the overall image.
> Actually this would be a subset of GTOPO30 data but I believe that is
> treated the same as an actual image.
>
> Since this seems to be a very common function, I was wondering if there
> isn't already a tool written to do this. That is a not Python tool.
see the manpage for gdal_translate
esp..
-srcwin xoff yoff xsize ysize:
Selects a subwindow from the source image for copying based on pixel/line location.
-projwin ulx uly lrx lry:
Selects a subwindow from the source image for copying (like -srcwin)
but with the corners given in georeferenced coordinates.
but ...
FWIW - I suggest you take a couple of hours and learn Python as it
exposes a lot of GDAL functionality in a *very* easy to use way :-)
http://www.python.org/topics/learn/prog.html
Norman
More information about the Gdal-dev
mailing list