[GRASS-user] v.patch and v.clean: how to preserve atribute table
Jarek Jasiewicz
jarekj at amu.edu.pl
Sat Apr 4 13:49:24 EDT 2009
Thanks,
I made it in similar ways with export to shapefile
but I tryied to avoid export ...
Paolo Craveri pisze:
> Hi Jarek
>
> 2009/3/31 Jarek Jasiewicz <jarekj at amu.edu.pl>:
>
>> problem seems to be very simple;
>>
> [...]
>
>> Any suggestion how to join these bundle of polygons into one vector and
>> preserve its attributies?
>>
>
> I have tried this:
>
> #!/bin/bash
> # # spearfish60
> db.connect database='$GISDBASE/$LOCATION_NAME/$MAPSET/mydbsqlite' driver=sqlite
> g.copy vect=soils,mysoils --overwrite
> # # # create a lot of vectors (polygons) to use as example
> for i in $(v.db.select soils col=cat -c); do
> v.extract in=mysoils out="pippo${i}" where="cat=${i}" --overwrite
> done
>
> # # try with v.out.ogr, ogr2ogr, v.in.ogr
> for vect in $(g.mlist type=vect pattern="pippo*"); do
> v.out.ogr in=${vect} dsn=./shptmp/ olayer=${vect} type=area
> format=ESRI_Shapefile
> done
>
> # # non topological merge
> index=1
> for shpfile in ./shptmp/*.shp; do
> if [ $index = 1 ]; then
> ogr2ogr "./shptmp/merge.shp" ${shpfile}
> else
> ogr2ogr -update -append "./shptmp/merge.shp"
> ${shpfile} -nln "merge"
> fi
> index=$(($index+1))
> done
> v.in.ogr dsn=./shptmp/ layer=merge out=merge_bad --overwrite
> v.clean in=merge_bad out=merge tool=bpol,rmdupl --overwrite
> v.db.select merge
> v.info -t mysoils
> v.info -t merge_bad
> v.info -t merge
>
> but I am not so sure about the final result...
>
> Can anyone tells me if above procedure is correct ? Many thanks in advance.
>
> ciao
>
>
More information about the grass-user
mailing list