[GRASS-user] gparser example for v.to.rast
Hamish
hamish_b at yahoo.com
Fri Feb 3 18:37:48 EST 2012
Johannes wrote:
> Is there a command to get the gparser code for a
> certain module from the GRASS command line? like
> v.to.rast --gparser.
yes,
v.to.rast --script
for python make the first line
#!/usr/bin/env python
instead of
#!/bin/sh
and replace the bits after the end of the #% lines
with something like,
import grass.script as grass
def main():
...code goes here
...end of your code
if __name__ == "__main__":
options, flags = grass.parser()
atexit.register(cleanup)
main()
explore the python scripts in grass7/scripts/ for
examples.
Hamish
More information about the grass-user
mailing list