[GRASSLIST:2944] Re: Importing intersectioning Raster-Files

Eric G. Miller egm2 at jps.net
Fri Jan 18 11:38:28 EST 2002


On Fri, 18 Jan 2002 11:46:43 +0100, "Harald Wehr" <hwehr at hs-harz.de> wrote:

> Hi GrassList,
> 
> I 've got several tiff-files, each with a corresponding tfw-file. 
> Unfortunately the files intersect a little bit with each other, as each 
> tiff-file has got an empty margin surrounding the map. Consider 
> following picture:
> 
> Map 1:                              I---------->6<
>                                      I >4<--->3< I
>                                      I  I     I  I
>                                      I  I     I  I
>                                      I >1<--->2< I
>                                     >5<----------I
> 
> Map 2:                              I---------->6<
>                                      I >4<--->3< I
>                                      I  I     I  I
>                                      I  I     I  I
>                                      I >1<--->2< I
>                                     >5<----------I
> 
> Each tiff-file contains everything from 5 to 6 while the actual 
> information is within 1,2,3,4. In this example the points 1,2 from map 1 
> would correspond to 4,3 from map 2.
> 
> Is it possible to produce one raster that contains all maps only with 
> the relevant information from each tiff between the inner rectangle?

The r.in.tiff command won't understand edges should be NULL.  But you
can postprocess it with r.nulls (if the edging is consistently a single
value).  You can then use r.patch, or r.mapcalc to aggregate them, 
though it's not always necessary or advisable.  I've done this in the
past with 8-bit palette color DRG's, where 0 always meant NULL.

Imagery may be more difficult to differentiate what should be NULL from
zero.  A possibility there, if you know the exact extents of the image
area, you can create a simple vector layer for each based on the extents.
Then generate a raster from the vector and either use it as a mask layer
or use it directly in an r.mapcalc "equation" to generate a new raster
where the edges will now be NULL values:

   echo "newrast = if(mask == 1, oldrast)" | r.mapcalc

Make sense?

-- 
Eric G. Miller <egm2 at jps.net>



More information about the grass-user mailing list