#Used from http://grass-gis.de/lit_html/grass60_v1.2_en/node57.html
grass /tmp/harta/cviko/
v.in.ogr dsn=frida-1.0.1-shp-joined/strassen-joined.shp output=strassen loc=frida
grass /tmp/frida/PERMANENT
v.in.ogr dsn=frida-1.0.1-shp-joined/poi-joined.shp output=points
v.category points out=points_2f layer=2 op=add
v.category points_2f layer=1,2 op=print # -> layer 1 == layer 2
v.extract in=points_2f out=hospitals_pre type=point where="poiTypName='Klinik/Hospital'"
v.select ainput=points_2f binput=hospitals_pre out=hospitals
v.info hospitals # -> one dblink
v.category hospitals layer=1,2 op=print # -> 2 layers
d.mon x0
d.erase
d.vect strassen
d.vect hospitals disp=attr attr=poiNameID bgcolor=white bcolor=black
d.vect hospitals col=red icon=basic/diamond
v.patch in=strassen,hospitals out=roads_hospitals
v.info roads_hospitals # -> dblinks = 0
d.erase
d.vect roads_hospitals
d.vect roads_hospitals type=point col=red
db.connect dr=dbf database='$GISDBASE/$LOCATION_NAME/$MAPSET/dbf/'
db.describe -c strassen
v.db.connect roads_hospitals dr=dbf data='$GISDBASE/$LOCATION_NAME/$MAPSET/dbf/' table=strassen layer=1 key=cat
v.db.connect roads_hospitals dr=dbf data='$GISDBASE/$LOCATION_NAME/$MAPSET/dbf/' table=hospitals layer=2 key=cat
v.db.connect -p roads_hospital
v.distance -p from=hospitals to=strassen output=roads_hospitals_connect upload=dist column=dist
v.patch in=roads_hospitals,roads_hospitals_connect out=hospitals_net_pre
v.clean in=hospitals_net_pre out=hospitals_net tool=break,snap thresh=0,1
g.remove vect=hospitals_net_pre,hospitals_pre
v.net.alloc input=hospitals_net output=hospitals_alloc ccats=40-215
d.vect map=hospitals_alloc color=red cats=40
d.vect map=hospitals_alloc color=green cats=41
d.vect map=hospitals_alloc color=blue cats=69
d.vect map=hospitals_alloc color=yellow cats=70
d.vect map=hospitals_alloc color=orange cats=71
d.vect map=hospitals_alloc color=indigo cats=84
d.vect map=hospitals_alloc color=violet cats=85
d.vect map=hospitals_alloc color=magenta cats=154
d.vect map=hospitals_alloc color=black cats=215
v.out.ogr -e input=hospitals_alloc type=line dsn=/tmp olayer=hospitals_alloc