[GRASS-user] loop import+merge

Patrick_schirmer patrick_GIS at gmx.ch
Tue Dec 14 07:32:03 EST 2010


Hi,

Still trying to create an import and merging of various files via a 
python-loop, as direct import is too heavy. I was searching on how to 
add a flag"-o" in python some days ago.  Found out that it will work 
with 'flags="o"' if I put it directly behind the command, but am still 
not able to combine two flags (-o and --o).

Even though, it seems that the loop I tried with "v.patch" will not work 
at all if input and output has the same filename. I would therefor have 
to create a dummy-file that will have to be a copied at the end of each 
iteration.

Kind of:
v.patch in=iterationresult,previousfinal out=temp
v.copy in=temp out=previousfinal --overwrite

Is there a command doing this "v.copy --overwrite"? Or does anyone have 
any other ideas on how to solve this task. It really is essential that I 
find any solution to this.

Thanks for your help,

Patrick


############script of loop###############
i=0
while i<150:
         i=i+1
         i=str(i)

         grass.run_command(
             'v.in.ogr', flags="o", dsn="PG:dbname=schirpat",
             layer="sc.av_liegensch", output="GR_av_liegensch_poly"+i,
             type="boundary,centroid", where="bfs="+i)

         grass.run_command(
             'v.patch',flags="-o", 
input="GR_av_liegensch_poly"+i+",GR_av_liegensch_poly", 
output="GR_av_liegensch_poly")


More information about the grass-user mailing list