script for selecting edges

Agustin Lobo alobo at ija.csic.es
Mon Feb 26 07:00:00 EST 1996


Thanks to suggestions and discussion with Ronald Wiemer and
Rick Thompson, I've found a way to select edges. The 
following script does it:

GRASS 4.1 > more $SCRIPTS/edge.scr
#!/bin/csh -f
echo "Hace un vector frontera entre dos clases de una imagen raster"
#set echo
#set verbose
if ($#argv < 2) then
        echo "USO: input(raster) clase1 clase2 output(vector)"
        exit
endif
r.mapcalc "del.me.1 = if($argv[1] == $argv[2])"
r.mapcalc "del.me.2 = if($argv[1] == $argv[3])"
r.grow in=del.me.1 out=del.me.1
r.grow in=del.me.2 out=del.me.2
r.mapcalc "del.me = if(($argv[1] == $argv[3]  && del.me.1 == 1) || ($argv[1] ==
 
$argv[2]  && del.me.2 == 1))"
r.thin in=del.me out=del.me
r.line in=del.me out=$argv[4]
g.remove rast=del.me,del.me.1,del.me.2 > callate
\rm callate

Agus

***************************************************
Dr. Agustin Lobo
Instituto de Ciencias de la Tierra (CSIC)
Marti Franques s/n
08028 Barcelona (Spain)

tel. 34 3 330 2716
fax. 34 3 411 0012

alobo at ija.csic.es
alobo at eno.princeton.edu
***************************************************





More information about the grass-user mailing list