SUMO导入OSM路网

460 阅读1分钟

从OSM获得深圳研究区路网

image.png 连接:导出 | OpenStreetMap

得到study.osm

将.osm格式转化成为SUMO所接纳的.net.xml格式

当前文件夹下打开终端,输入:

netconvert --osm-files study.osm -o study.net.xml

生成路由文件.rou.xml(使用randomTrips.py)

image.png

在SUMO文件下找到该生成路由代码

输入

python randomTrips.py -n study.net.xml -r study.rou.xml -e 50 -l

生成仿真文件

image.png

将生成的文件放到另一文件夹下,并创建.sumocfg文件

image.png

<?xml version="1.0" encoding="utf-8"?>
<configuration xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <input>
    <net-file value="study.net.xml" />
    <route-files value="study.rou.xml" />
  </input>
  <time>
    <begin value="0" />
    <end value="2000" />
  </time>
</configuration>

设置好路网和路由文件,起始和结束时间

启动仿真文件

image.png