[GRASS-user] v.to.rast in a python loop, error
JRadinger at gmx.at
Wed Feb 8 07:09:07 EST 2012
> On 8 February 2012 11:35, Johannes Radinger <JRadinger at gmx.at> wrote:
> > I try to run v.to.rast of a line in a loop
> > to get a raster for each attribute of the vector (multiple columns).
> > Therefore I created a short python script, which is working
> > expept for that I am getting error messages:
> > ERROR: option <output>: <raster_attribute> exists.
> > Here the code:
> > #!/usr/bin/env python
> > import sys
> > import grass.script as grass
> > import grass.script.setup as gsetup
> > def main():
> > for i in ['FULL_HYDRO','LENGTH']:
> > grass.run_command("v.to.rast",
> > input = "streams at PERMANENT",
> > output = "rast_"+i,
> > type = "line",
> > use = "attr",
> > column = i)
> > return 0
> > if __name__ == "__main__":
> > sys.exit(main())
> Have you tried adding flags = '-o' as an argument to
> grass.run_command? That will overwrite the output raster if it already
I haven't tried yet to use the overwrite option. It'll probably work. It is just that I am wondering why these rasters "exist" although all rasters are entirely removed from the mapset.
Can you reproduce this behaviour with that script and the North Carolina dataset?
> grass-user mailing list
> grass-user at lists.osgeo.org
NEU: FreePhone 3-fach-Flat mit kostenlosem Smartphone!
Jetzt informieren: http://www.gmx.net/de/go/freephone/
More information about the grass-user