标签:strong ima pem map 环境变量 环境 card 使用 evel
1、下载SUMO
下载地址:https://sourceforge.net/projects/sumo/
下载后解压到目录D:\tools\sumo-0.19.0
2、下载python
下载地址:https://www.python.org/downloads/windows/
需下载2.7.版本以上
下载后安装
3、设置环境变量
设置sumo和python的环境变量
4、生成一个路网
4.1 在OpenStreetMap下载地图
点击网址https://www.openstreetmap.org
搜索地址,比如杭州,选择合适的地点放大,屏幕看到的部分就是保存的部分,点击导出,自动保存为map.osm
4.2 NetConvert
Osm文件不能直接被SUMO使用,需要通过Netconvert进行格式转换
在map.osm路径下打开cmd,输入命令:
netconvert --osm-files map.osm -o hangzhou.net.xml
在当前路径下会生成文件hangzhou.net.xml
输入命令sumo-gui,打开sumo
打开hangzhou.net文件
结果如下,只有线条,没有纹理。
4.3 PloyConvert
在当前目录下新建文件typemap.xml,填写如下内容:
<polygonTypes>
<polygonType id="waterway" name="water" color=".71,.82,.82" layer="-4"/>
<polygonType id="natural" name="natural" color=".55,.77,.42" layer="-4"/>
<polygonType id="natural.water" name="water" color=".71,.82,.82" layer="-4"/>
<polygonType id="natural.wetland" name="water" color=".71,.82,.82" layer="-4"/>
<polygonType id="natural.wood" name="forest" color=".55,.77,.42" layer="-4"/>
<polygonType id="natural.land" name="land" color=".98,.87,.46" layer="-4"/>
<polygonType id="landuse" name="landuse" color=".76,.76,.51" layer="-3"/>
<polygonType id="landuse.forest" name="forest" color=".55,.77,.42" layer="-3"/>
<polygonType id="landuse.park" name="park" color=".81,.96,.79" layer="-3"/>
<polygonType id="landuse.residential" name="residential" color=".92,.92,.89" layer="-3"/>
<polygonType id="landuse.commercial" name="commercial" color=".82,.82,.80" layer="-3"/>
<polygonType id="landuse.industrial" name="industrial" color=".82,.82,.80" layer="-3"/>
<polygonType id="landuse.military" name="military" color=".60,.60,.36" layer="-3"/>
<polygonType id="landuse.farm" name="farm" color=".95,.95,.80" layer="-3"/>
<polygonType id="landuse.greenfield" name="farm" color=".95,.95,.80" layer="-3"/>
<polygonType id="landuse.village_green" name="farm" color=".95,.95,.80" layer="-3"/>
<polygonType id="tourism" name="tourism" color=".81,.96,.79" layer="-2"/>
<polygonType id="military" name="military" color=".60,.60,.36" layer="-2"/>
<polygonType id="sport" name="sport" color=".31,.90,.49" layer="-2"/>
<polygonType id="leisure" name="leisure" color=".81,.96,.79" layer="-2"/>
<polygonType id="leisure.park" name="tourism" color=".81,.96,.79" layer="-2"/>
<polygonType id="aeroway" name="aeroway" color=".50,.50,.50" layer="-2"/>
<polygonType id="aerialway" name="aerialway" color=".20,.20,.20" layer="-2"/>
<polygonType id="shop" name="shop" color=".93,.78,1.0" layer="-1"/>
<polygonType id="historic" name="historic" color=".50,1.0,.50" layer="-1"/>
<polygonType id="man_made" name="building" color="1.0,.90,.90" layer="-1"/>
<polygonType id="building" name="building" color="1.0,.90,.90" layer="-1"/>
<polygonType id="amenity" name="amenity" color=".93,.78,.78" layer="-1"/>
<polygonType id="amenity.parking" name="parking" color=".72,.72,.70" layer="-1"/>
<polygonType id="power" name="power" color=".10,.10,.30" layer="-1" discard="true"/>
<polygonType id="highway" name="highway" color=".10,.10,.10" layer="-1" discard="true"/>
<polygonType id="boundary" name="boundary" color="1.0,.33,.33" layer="0" fill="false" discard="true"/>
<polygonType id="admin_level" name="admin_level" color="1.0,.33,.33" layer="0" fill="false" discard="true"/>
</polygonTypes>
上述内容也可以从http://sumo.dlr.de/wiki/Networks/Import/OpenStreetMap 的Importing additional Polygons的虚线框里的复制过来。
在命令行里输入:
polyconvert -n hangzhou.net.xml --osm-files map.osm --osm.keep-full-type --type-file typemap.xml -o hangzhou.poly.xml
运行完之后生成文件hangzhou.poly.xml
输入命令查看结果
sumo-gui -n hangzhou.net.xml -a hangzhou.poly.xml
运行结果如下,图上出现了楼房、绿地等信息等。
标签:strong ima pem map 环境变量 环境 card 使用 evel
原文地址:https://www.cnblogs.com/snail123/p/10015162.html