0

I am trying to convert OSM to network for SUMO. I do exactly as the below: I installed SUMO, Python 3.4.4 Downloaded OSM file from openstreetmap.com Using the command below to convert osm to net, bet here is the ERROR:

Error: Could not open types-file 'G:\Program Files\DLR\Sump /data/typemap/osmNetconvert.typ.xml'.

enter image description here

Ebola
  • 43
  • 10
  • Please [edit] your question and show us your code. It looks like you mix Windows and Linux paths. –  Mar 10 '16 at 09:16
  • please see the picture @LutzHorn – Ebola Mar 10 '16 at 09:18
  • @LutzHorn Is it clear?! Can you see the problem or should I explain more? – Ebola Mar 10 '16 at 09:29
  • What is `netconvert`? –  Mar 10 '16 at 09:41
  • `/data/typemap/osmNetconvert.typ.xml` is obviously the wrong path. Where is your osmNetconvert.typ.xml located? – scai Mar 10 '16 at 10:50
  • @scai exactly at the path mentioned above. I mean it is in: g:/program files/DLR/sumo/data/typemap/ but it can not find it! I don't know why! – Ebola Mar 10 '16 at 13:17
  • @LutzHorn NETCONVERT imports digital road networks from different sources and generates road networks that can be used by SUMO. – Ebola Mar 10 '16 at 13:18
  • @Ebola No. A path starting with `/` is an *absolute* path. If you want to specify the *absolute* path then use `G:/program files/DLR/sumo/data/typemap/osmNetconvert.typ.xml`. If you want to specify the *relative* path then use `../sumo/data/typemap/osmNetconvert.typ.xml`. – scai Mar 10 '16 at 13:56
  • @scai I didn't get it! I write the netconverter keyword to convert .osm to .net in order to use it in SUMO. but the error in the image appears. I am sure that the path is correct, but I don't get it why it has been written with "/" and "\"?!!! The path appeared in the top is not on me ... it is an error and I don't know why it is in that order with / and \ ! – Ebola Mar 10 '16 at 14:08
  • @Ebola Then I guess you have to check where this path comes from. Maybe from a configuration, maybe it is hard-coded. And as far as I know it is perfectly valid to use `/` as path separator on Windows. – scai Mar 10 '16 at 14:31

2 Answers2

1

This is actually a bug in the start-command-line.bat script you used. As you can see when looking closely it adds an extra space to the SUMO_HOME directory, you can verify it by doing

echo "%SUMO_HOME%"

which should result in

"G:\Program Files\DLR\Sumo"

but will probably print

"G:\Program Files\DLR\Sumo "

To fix it you need to edit the script G:\Program Files\DLR\Sumo\bin\start-command-line.bat and remove all the spaces in front of the && signs, so replace

cmd /K "set PATH=%PATH%;%sumo_home%\bin;%python_dir%;%sumo_home%\tools && set PYTHONPATH=%PYTHONPATH%;%sumo_home%\tools && set SUMO_HOME=%sumo_home% & cd /d %default_dir% && echo info: added location of sumo, tools and python to the search path && echo info: variable SUMO_HOME is set to %SUMO_HOME% && echo. && echo use the 'cd /d' command to change directory && echo example usage: && echo cd /d c:\foo\bar

with

cmd /K "set PATH=%PATH%;%sumo_home%\bin;%python_dir%;%sumo_home%\tools& set PYTHONPATH=%PYTHONPATH%;%sumo_home%\tools& set SUMO_HOME=%sumo_home%& cd /d %default_dir%& echo info: added location of sumo, tools and python to the search path& echo info: variable SUMO_HOME is set to %SUMO_HOME%& echo.& echo use the 'cd /d' command to change directory& echo example usage:& echo cd /d c:\foo\bar

or use the new version from the subversion repository if you want.

I also replaced the double ampersands ("&") with single ones although it does not really matter here because they only differ in functionality if any of the commands fail which should not happen with "set" or "echo". In any case with the single "&" execution will continue even if one of the commands fails, see How to run two commands in one line in Windows CMD?

Community
  • 1
  • 1
Michael
  • 3,510
  • 1
  • 11
  • 23
0

Your command is missing = .

Correct command is:

 netconvert --osm-files=map.osm -o map.net.xml
4b0
  • 21,981
  • 30
  • 95
  • 142