[GRASS-user] automated cropping of reprojected images

Maciej Sieczka tutey at o2.pl
Sat Jul 15 13:36:29 EDT 2006


Glynn Clements napisa?(a):
> 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.
> 
> Any import module (r.in.*) will produce a map which has the same
> number of rows and columns as the image being imported.
> 
> Any other module will produce a map which has the same number of rows
> and columns as the current region.
> 
> Any export module will produce an image which has the same number of
> rows and columns as the current region.

Glynn,

Not in case of r.out.gdal. It preserves the raster's resolution and
extent (which I like). Ideally, each export module should have a switch
to allow for raster-wise and region-wise export IMHO.

Maciek




More information about the grass-user mailing list