[GRASS-user] v.to.rast in a python loop, error

Johannes Radinger JRadinger at gmx.at
Wed Feb 8 04:35:40 EST 2012


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 I'd like to post the script which I tried on the North Carolina Dataset (streams vector) on GRASS 6.5SVN49268M (on Mac OSX with Python 2.6.6) with the same errors.

Can you also reproduce this? Maybe somebody knows what is causing this? Probably there is something wrong with my script as I am just in the beginning of writing python scripts... I am wondering as the command v.to.rast with the interactive menu works perfectly (no errors.)

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']:

                    input = "streams at PERMANENT",
                    output = "rast_"+i,
                    type = "line",
                    use = "attr",
                    column = i)

    return 0

if __name__ == "__main__":

Best regards,

NEU: FreePhone 3-fach-Flat mit kostenlosem Smartphone!                                  
Jetzt informieren: http://www.gmx.net/de/go/freephone/

More information about the grass-user mailing list