/usr/share/sumo/tools/shapes/CSV2polyconvertXML.py is in sumo-tools 0.15.0~dfsg-2.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | #!/usr/bin/env python
"""
@file CSV2polyconvertXML.py
@author Daniel Krajzewicz
@author Michael Behrisch
@date 2008-07-17
Converts a given CSV-file that contains a list of pois to
an XML-file that may be read by POLYCONVERT.
SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/
Copyright (C) 2008-2012 DLR (http://www.dlr.de/) and contributors
All rights reserved
"""
import sys
if len(sys.argv)<4:
print "Error: Missing argument(s)"
print "Call: CSV2polyconvertXML.py <CSV_FILE> <OUTPUT_FILE> <VALUENAME>[,<VALUENAME>]*"
print " The values within the csv-file are supposed to be divided by ';'."
print " <VALUENAME>s give the attribute names in order of their appearence within the csv-file ."
exit()
names = sys.argv[3].split(',')
inpf = open(sys.argv[1])
outf = open(sys.argv[2], "w")
outf.write("<pois>\n")
for line in inpf:
if len(line)==0 or line[0]=='#':
continue
vals = line.strip().split(';')
outf.write(" <poi")
for i,n in enumerate(names):
outf.write(' ' + n + '="' + vals[i] + '"')
outf.write("/>\n")
outf.write("</pois>\n")
inpf.close()
outf.close()
|