[GRASSLIST:10388] Re: How to clip/cut a large image into a set of smaler images

Dylan Beaudette dylan.beaudette at gmail.com
Fri Feb 17 20:30:29 EST 2006


On Thursday 16 February 2006 02:47 pm, Lars Forseth wrote:
> hi!
>
> I'm trying to find out how to clip a large geotiff landsat image into
> several smaller images; but I'm not finding any commands that seems to fit
> the bill! Possibly because I don't know quite where or what to look for!
>
> Theres two things I would like to do:
>
> 1. Clip the image into several smaller "tiles"; either by defining
> rectangle size or by creating a vector grid that is used to "cut" the
> larger image into smaller ones.
>
> 2. Clip the image according to a municipality; i.e I have the area of the
> municipality as both a raster (binary); and a vector. The resulting image
> should be a geotiff or raster datasett that follows the borders of the
> municipality.
>
> Sorry if this is a FAQ. I have looked at the GRASS GIS book
> (Mitasova/Neteler), GDAL docs and various searches by Google (all return
> too much information).
>
> Regards
>
> Lars F
>
> Archaeologist
> NTFK


Here is a quick script that I used to tile a landsat mosaic:

#zoom to the extent of the mosaic and make the grid
g.region vect=ca_bnd
v.mkgrid map=ca_100km_grid grid=10,5

#extract each grid location into a single file
for x in `seq 1 1 50`
 do 
v.extract -t in=ca_100km_grid out=ca_100km_grid_$x list=$x 
d.vect ca_100km_grid_$x
done

#clip the mosaic at each grid location
for x in `seq 1 1 50`
do 
g.region vect=ca_100km_grid_$x
r.mapcalc "ca_landsat_shade_$x = ca_landsat_shade"
 done

cheers,

-- 
Dylan Beaudette
Soils and Biogeochemistry Graduate Group
University of California at Davis
530.754.7341




More information about the grass-user mailing list