[GRASS-user] Python-Loop over points

Daniel Victoria daniel.victoria at gmail.com
Mon Feb 7 19:25:31 EST 2011


Hi Johannes,

You will need to use for loop. Something like this (UNTESTED!)

for p in range(5):
    points_map = "point"+str(p)
    out_map = "output"+str(p)
    grass.run_command("r.streams.basins", dir = "flow_direction,
points=points_map, basins = out_map)

That should work, or at least something similar

Daniel

On Wed, Feb 2, 2011 at 9:39 AM, Johannes Radinger <JRadinger at gmx.at> wrote:
> Hello,
>
> I am performing e.g. the r.stream.basins calcutlation in python:
>
>    grass.run_command("r.stream.basins",
>                      dir = "flow_direction",
>                      points = "point1",
>                      basins = "output")
>
> that's working perfectly in the case of one single point in "point1".
> How can I do that multiple times when the point layer consist of e.g. 5
> points and I want to create an output for each point (create 5 output rasters).
>
> How can that be done in a python script?
>
>
> thank you
>
> Johannes
>
> --
> NEU: FreePhone - kostenlos mobil telefonieren und surfen!
> Jetzt informieren: http://www.gmx.net/de/go/freephone
> _______________________________________________
> grass-user mailing list
> grass-user at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/grass-user
>


More information about the grass-user mailing list