[GRASS-user] SQL query in python scripts using v.to.rast
Alessandro Sebastiani
alessandro.sebastiani at uniroma1.it
Fri Nov 9 03:49:46 PST 2018
Dear all
i have a vector (downloaded from OpenStreetmap) with all the streets in my
study area. Streets are divided in categories (there is a specific string
column in the db). now i want to convert to raster each category
separately. I now how to do that separately, but i was not able to automate
that in a python script. here it is what i wrote:
*>>>*import grass.script as gscript
*>>>*types = ("primary" , "secondary" , "tertiary" , "service" ,
"pedestrian" , "footway" , "residential" , "path")
*>>>*for typ in types:
*>>>> * gscript.run_command ("v.to.rast" , input = "road_clip" , type =
"line" , where ="type"=typ , output = types, use = "attr" ,
attribute_column = "cat").
*I got the following traceback:* File
"/home/alessandro/GRASSDATA/5_citta_def/5_citt_def/.tmp
/alessandro-Lenovo-G50-70/5500.6.py", line 6
gscript.run_command ("v.to.rast" , input = "road_clip" ,
type = "line" , where ="type"=typ , output = types, use =
"attr" , attribute_column = "cat")
^
SyntaxError: invalid syntax
i guess the syntax error is in the way i set the query, but i'm not sure.
Thanks to everybody,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-user/attachments/20181109/f717851f/attachment.html>
More information about the grass-user
mailing list