Hello,
I think there is a python problem when you write :
i=0
while i<150:
i=i+1
i=str(i)
In fact, transform i in a string would cause python to stop the loop
after the first iteration.
You may change this by another variable like j, like the following :
i=0
while i<150:
i=i+1
j=str(i)
grass.run_command(
'v.in.ogr', flags="o", dsn="PG:dbname=schirpat",
layer="sc.av_liegensch", output="GR_av_liegensch_poly"+j,
type="boundary,centroid", where="bfs="+j)
grass.run_command(
'v.patch',flags="-o",
input="GR_av_liegensch_poly"+j+",GR_av_liegensch_poly",
output="GR_av_liegensch_poly")
Try it and tell us if it works, yeah ?
Thibault.
Le 14/12/2010 13:32, Patrick_schirmer a écrit :
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")
_______________________________________________
grass-user mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/grass-user
_______________________________________________
grass-user mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/grass-user