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

If you apply a patch file with edge speeds (and no other edge attributes) to an existing .net.xml file then it should not affect any geometries (assuming the original network was created with the same netconvert version).  If you have a counter example, please open an issue on github.
Caveat: there actually might be minor changes if the original .net.xml came directly from an osm import because the projected coordinates use more digits than the .net.xml. However, if you already did manual changes (which implies writing and loading one more time) than you should be fine.

Am Di., 20. Dez. 2022 um 10:49 Uhr schrieb Sasan Amini <aminissn@xxxxxxxxx>:
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
_______________________________________________
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