Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [sumo-user] Programmatic Access to NETEDIT

To change a node position you can create a patch file like this:
<nodes>
  <node id="myNodeID" x="newX" y="newY"/>
<nodes>
netconvert -s old.net.xml -n patch.nod.xml -o patched.net.xml

This can be done in ~4 lines of python so you won't get a big advantage from using sumolib.xml.parse.


Unfortunately, we never got around to documenting all sumolib functionality.
SUMO documentation tends to grow via user questions so feel free to ask about specific functions.

regards,
Jakob

Am Do., 31. Jan. 2019 um 22:53 Uhr schrieb <cchadj01@xxxxxxxxxxxx>:
Hello,

  Thank you for for the prompt reply.
  I have searched into sumolib.xml.parse but I can't see how I can use 
it as I can't find any documentation. I have also tried sumolib but I 
can not see how I can change a node's position.

Thank you,
Tom

Quoting Jakob Erdmann <namdre.sumo@xxxxxxxxx>:

> Hello,
> The only supported way to create networks is via netconvert. For
> programmatic modifications you can either:
> a)   - convert the network to plain-xml
>       - modify those (sumolib.xml.parse can help with that. It creates
> objects that allow attribute access and which can write themselves back out
> as xml)
>       - re-assemble into .net.xml with netconvert
>
> b) generate patch files and patch the .net.xml using netconvert (patch
> files are like plain-xml files but you only need to set those attributes
> you wish to change)
>
> - you can read the network graph using function sumolib.readNet (
> http://sumo.dlr.de/wiki/Tools/Sumolib)
> - you can modify the network while the simulation is running by changing
> lane permission (If you add forbidden edges beforehand you can activate
> them at runtime and vice versa)
>
> regards,
> Jakob
>
>
> Am Mi., 30. Jan. 2019 um 20:17 Uhr schrieb <cchadj01@xxxxxxxxxxxx>:
>
>> Hello,
>>
>>   I was wondering if I can have any programmatic access to netedit so
>> I can change my network from code or any other way I can change a road
>> network from code for that matter.
>>   I wouldn't want to reinvent the wheel by creating an xml parser and
>> editor.
>>
>> Thank you,
>> Tom
>>
>>
>>
>>
>> _______________________________________________
>> sumo-user mailing list
>> sumo-user@xxxxxxxxxxx
>> To change your delivery options, retrieve your password, or unsubscribe
>> from this list, visit
>> https://www.eclipse.org/mailman/listinfo/sumo-user
>>


_______________________________________________
sumo-user mailing list
sumo-user@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://www.eclipse.org/mailman/listinfo/sumo-user

Back to the top