Hi
problem seems to be very simple;
I have several (over thousand) vectors of polygons with attribute tables (every vector has one polygon). I must join them in one vector file so I do it with followning comands.
patchw=`g.mlist type=vect pattern=a_?? separator=,`
v.patch input=$patchw output=b_2 --overwrite
And I recive patched vector. Unfortunately polygons have shared boundaries so I use v.clean to remove duplicated boundaries:
v.clean input=b_2@rzeki output=b2 type=boundary tool=rmdupl --overwrite
And I have cleaned polygons but I loose attribute table. More over every polygon has category 1
So it seems proposed procedre is wrong.
Any suggestion how to join these bundle of polygons into one vector and preserve its attributies?
Jarek
Hi Jarek
2009/3/31 Jarek Jasiewicz <jarekj@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
--
--
Paolo C.
Lat. 44° 39' 11.08'' N Long. 7° 23' 25.26'' E
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@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