Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [sumo-user] write sumo Networks using sumolib

there is a "problem" with this approach, namely rerunning netconvert.
This may affect some geometries or attributes that are already
(manually) changed. I was thinking of something like this:
def modifySumoNetSpeed(network_path:str,selected_lanes:list,newSpeed:str):
    tree = ET.parse(network_path)
    root = tree.getroot()
    for edge in root.iter('edge'):
        for lane in edge.iter('lane'):
            if lane.get('id') in selected_lanes:
                lane.set('speed', newSpeed)
    tree.write('output.net.xml')
    return True

On Fri, Dec 16, 2022 at 5:06 PM Jakob Erdmann <namdre.sumo@xxxxxxxxx> wrote:
>
> see https://sumo.dlr.de/docs/Tutorials/ScenarioGuide.html#modifying_node_positions_with_the_help_of_sumolib
>
> Am Fr., 16. Dez. 2022 um 14:24 Uhr schrieb Sasan Amini <aminissn@xxxxxxxxx>:
>>
>> Dear all,
>>
>> is there an option to change some of the network attributes using
>> sumolib and save the new network? I think currently the option is not
>> supported and not sure how difficult would it be to implement that.
>> e.g. to change the speed limit or allowed vehicle classes to have
>> multiple versions of a base network.
>> I know parsing the XML using xmltree could work, but I think changing
>> attributes directly in the xml is not the best (error free) way.
>>
>> Thanks
>> Sasan
>> _______________________________________________
>> sumo-user mailing list
>> sumo-user@xxxxxxxxxxx
>> To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/sumo-user
>
> _______________________________________________
> sumo-user mailing list
> sumo-user@xxxxxxxxxxx
> To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/sumo-user


Back to the top