- ubuntu16.04
- sumo-1.1.0
- python (higher than 2.7)
- matplotlib
- pyproj
- rtree
- overpy
- folium
- dill
if you use bash
echo "export SUMO_HOME=/usr/share/sumo" >> ~/.bashrc
source ~/.bashrc
# if you use python on system, you need `sudo -H`
pip install matplotlib
rtree need spatialindex
wget http://download.osgeo.org/libspatialindex/spatialindex-src-1.8.5.tar.gz
cd spatialindex-src-1.8.5
mkdir build
cd build
cmake ..
make -j 4
sudo make install
sudo ldconfig
# if you use python on system, you need `sudo -H`
pip install pyproj
pip install rtree
pip install overpy
pip install folium
pip install dill
It is difficult to use SUMO, if you first try.
There are 3 steps.
There are three method.
- netgenerate
- OpenStreatMap
- netedit
- random Trips
- duarouter
- sumo
- sumo-gui
If you want to create simple map easy, you should use netgenerate.
netgenerate has three types map.
- gridmap
./gridnetgen.sh
./draw_net.py -n gridmap/map.net.xml
- spidermap
./spidernetgen.sh
./draw_net.py -n spidermap/map.net.xml
- randommap
./randamnetgen.sh
./draw_net.py -n randommap/map.net.xml
./runner.py gridmap
This script include randomTrips and duarouter and sumo-gui.
If you want to use real map, you should use a osmWebWizard tool.
./osmWebWizard.sh
You set a your favarite location. I set "Tokyo".
Push car icon, then push like this.
Also push Generate Scenario. It takes a few minutes. If this successed, appear sumo-gui.
You push Start button.
This is a tools to find closeset edge from longitude and latitude.
./getNeighboringEdges.py -n osm/Tokyo/osm.net.xml --lon 139.765 --lat 35.68
Red point is a point you set (lon lat).
Blue edge is a closest edge line.
Console output closest edge and distance
net file : osm/Tokyo/osm.net.xml
(lon,lat) : (139.765, 35.68)
(x,y) : (8618.109951582097, 3573.570724199526)
closest edge : <edge id="363564525#2" from="3677320551" to="3925244022"/>
distance : 18.126912151173638
Check convenience store in erea.
Save *.pkl file.
./check_spots/save_pkl.py
Check in browser.
./check_spots/load_pkl.py
firefox map.html
map.net.xml
...
<location netOffset="0.00,0.00" convBoundary="0.00,0.00,60.00,60.00" origBoundary="0.00,0.00,60.00,60.00" projParameter="!"/>
...
convBoundary is important.
you use this number in plot_net_speed.py
...
--xlim 0,60 --ylim 0,60 \
...
Python3 is not difined unicode.
calling route2trips
Traceback (most recent call last):
File "/usr/share/sumo/tools/osmWebWizard.py", line 432, in build
builder.build()
File "/usr/share/sumo/tools/osmWebWizard.py", line 304, in build
(randomTripsPath, " ".join(map(quoted_str, self.getRelative(opts)))))
File "/usr/share/sumo/tools/osmWebWizard.py", line 164, in getRelative
if type(o) in [str, unicode] and o[0:l] == dirname:
NameError: name 'unicode' is not defined
So you need repair this error.
Before
osmWebWizard.py
159 def getRelative(self, options):
160 result = []
161 dirname = self.tmp
162 l = len(dirname)
163 for o in options:
164 if type(o) in [str, unicode] and o[0:l] == dirname:
165 remove = o[:l+1]
166 result.append(o.replace(remove, ''))
167 else:
168 result.append(o)
169 return result
After
159 def getRelative(self, options):
160 result = []
161 dirname = self.tmp
162 l = len(dirname)
163 for o in options:
164 try:
165 UNICODE_EXISTS = bool(type(unicode))
166 except NameError:
167 unicode = lambda s: str(s)
168 if type(o) in [str, unicode] and o[0:l] == dirname:
169 remove = o[:l+1]
170 result.append(o.replace(remove, ''))
171 else:
172 result.append(o)
173 return result
-
https://wiki.openstreetmap.org/wiki/Overpass_API/Installation
-
https://wiki.openstreetmap.org/wiki/JA:Overpass_API/%E8%A8%80%E8%AA%9E%E3%82%AC%E3%82%A4%E3%83%89