On 8 February 2012 11:35, Johannes Radinger <[email protected]> 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@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 exists. Cheers, Scott _______________________________________________ grass-user mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/grass-user
