[GRASSLIST:4194] Re: ITCSpam: Adding CATS to buffered lines (Grass5.7)

Radim Blazek blazek at itc.it
Tue Aug 17 04:03:02 EDT 2004


Do you want again a buffer with cats from original lines? 
Note that then 'overlapping' buffer areas may have more cats.
I would use something like this:

v.in.ascii -e output=seisbuf

for MYCAT in 13 3 12 2;
do
    v.extract input=seismicselect output=seismicselecttemp \
              list=$MYCAT new=-1

    v.buffer input=seismicselecttemp output=seistempbuf \
             type=line buffer=3  # the buffer has cat=1
  
    let "ADD=$MYCAT-1"

    v.category input=seistempbuf output=seistempbuf2 type=centroid \
               option=sum cat=$ADD   # the buffer has cat=$MYCAT

    v.overlay -t ainput=seisbuf binput=seistempbuf2 output=seistempbuf3 \
                 ofield=0,1,1  # input cats are written to output with field=1

    g.copy -o vect=seistempbuf3,seisbuf
done


Radim
 

On Tuesday 17 August 2004 01:22, Craig Aumann wrote:
> The way I've cobbled CATs onto buffered lines is given below.
>
> I have two questions:
>
> - Is there a better way to do this?
>
> - What is the appropriate tool to use for v.clean after I have patched
> everything together?  The tool svtlx (listed in the man page for
> v.patch) does not exist in v.clean.
>
> I'm not that concerned about the intersections between the buffered
> lines - they could be assigned to the CAT for any of the original
> lines.
>
>
>
> declare -i MYCOUNTER
> MYCOUNTER=1
>
> for MYCAT in 13 3 12 2;
> do
>   v.extract input=seismicselect output=seismicselecttemp \
>       list=$MYCAT new=-1
>
> ## buffer it.
>   v.buffer input=seismicselecttemp output=seistempbuf type=line buffer=3
>
>   v.category input=seistempbuf output=seistempbuf2 type=centroid \
>       option=add field=2 step=1
>   v.category input=seistempbuf2 output=seistempbuf3 type=centroid \
>       option=sum field=2 cat=-1
>   v.category input=seistempbuf3 output=seistempbuf1 type=centroid \
>       option=sum field=2 cat=$MYCAT
>
>   if test "$MYCOUNTER" -eq 1; then
>       let "MYCOUNTER=$MYCOUNTER+1"
>       v.patch input=seistempbuf1 output=seisfintemp
>   else
>       v.patch input=seistempbuf1,seisfintemp output=seisfintemp2
>       g.remove vect=seisfintemp
>       g.copy vect=seisfintemp2,seisfintemp
>   fi
>
> done
>
> v.category input=seisfintemp option=report




More information about the grass-user mailing list