[GRASS-user] automated cropping of reprojected images

Trevor Wiens twiens at interbaun.com
Thu Jul 13 10:31:58 EDT 2006


On Thu, 13 Jul 2006 10:51:27 +0100
Glynn Clements <glynn at gclements.plus.com> wrote:

> 
> Trevor Wiens wrote:
> 
> > I'm wondering if there is an easy way to crop reprojected images. In
> > this case it is for landsat images that will eventually be layed
> > together to cover most of Canada. Thus the extra space that is created
> > in rotating the images becomes an issue.
> > 
> > I tried importing, using r.null and then reprojecting, but when I
> > exported the file, it didn't make any difference. I also tried
> > creating a MASK to remove all NULL values, but this too was to no avail
> > upon export.
> > 
> > Any suggestions on how to tackle this would be appreciated.
> 
> I'm not entirely sure what you're asking here.
> 
> When you export raster map, the resulting file has the same number of
> rows and columns as the current region at the time that you export. If
> you shrink the region, you'll get a smaller image.
> 
> Or are you referring to something else?

Sorry for not being clear.

As Paulo mentioned I am talking about the big black regions around the
landsat images. I can visually adjust the region, but with the volume
of images I'm dealing with here, that isn't practical so I'm looking
for a programmatic method. For example I tried to make a MASK and then
set g.region rast=MASK, but the MASK includes all the nulls or zeros so
the region size doesn't change. I also tried creating a copy of the
file with r.mapcalc using the MASK hoping the end file would have a
smaller region and then did g.region rast=<mask r.mapcalc output>, but
the region size again didn't change. I want to set the region to an
area that only has actual data, not nulls.

Ideally, it would be nice to be able to determine this using gdal so I
can crop the images with gdalwarp without having to import and export
as the client wants to use these images to check the results of change
analysis after being run between pairs of the original images in the
UTM projection they were acquired in.

T
-- 
Trevor Wiens 
twiens at interbaun.com

The significant problems that we face cannot be solved at the same 
level of thinking we were at when we created them. 
(Albert Einstein)




More information about the grass-user mailing list