[GRASS-user] obtain node sequence from v.net.salesman

Gavin Fleming gavin at afrispatial.co.za
Tue May 8 06:31:20 EDT 2012


this is how I did it:

        grass.run_command('g.gisenv', set="DEBUG=2")
        p = grass.pipe_command('v.net.salesman', overwrite = True,
_in='network_clean', output='salesman', nlayer=1, ccats=cats)
        result = []
        for line in p.stdout:
            result.append(line)
        p.wait()
        print result[-2] #this is where the node sequence sits in the debug
output

On 8 May 2012 00:43, Gavin Fleming <gavin at afrispatial.co.za> wrote:

>
>
>> The last line of the output should look like this, giving you the
>> category values of the nodes in route order:
>>
>> Nodes' categories (layer 2, 994 nodes):
>> 42,41,164,38,126,15,52,84,16,**55,17,157,60,6,61,8,1,76,72,**46,47,68,24,25,26,28
>>
>>
>>
> How could I parse the 'Nodes categories' array from the debug output (I'm
> stuck with 6.4.1 for now)?  More specifically , I need to do it in Python
> with grass.script.
>
> Gavin
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/grass-user/attachments/20120508/fe4524da/attachment.html


More information about the grass-user mailing list