21 package org.matsim.run;
23 import java.util.Iterator;
66 System.out.println(
"conversion settings...");
68 System.out.println(
"done.");
71 if (srModule != null) { srModule.
run(network); }
72 if (mrModule != null) { mrModule.
run(network); }
74 if (writeNetworkXmlFile) {
75 System.out.println(
"writing xml file...");
77 System.out.println(
"done.");
79 if (writeNetworkTxtFile) {
80 System.out.println(
"writing txt files...");
83 System.out.println(
"done.");
85 if (writeNetworkShapeFile) {
86 System.out.println(
"writing shape file...");
93 System.out.println(
"done.");
104 if (srModule != null) { srModule.
printInfo(
" "); }
105 if (mrModule != null) { mrModule.
printInfo(
" "); }
106 System.out.println(
" output:");
107 System.out.println(
" outputDir: "+outputDir);
108 System.out.println(
" writeNetworkXmlFile: "+writeNetworkXmlFile);
109 System.out.println(
" writeNetworkTxtFile: "+writeNetworkTxtFile);
110 System.out.println(
" writeNetworkShapeFile: "+writeNetworkShapeFile);
119 boolean ignoreFrcType8 =
false;
120 boolean ignoreFrcType7onewayN =
false;
121 int maxFrcTypeForDoubleLaneLink = Integer.MIN_VALUE;
122 int minSpeedForNormalCapacity = Integer.MAX_VALUE;
124 boolean removeUTurns =
false;
125 double expansionRadius = Double.NaN;
126 double linkSeparation = Double.NaN;
128 if (args.length == 0) { System.out.println(
"Too few arguments.");
printUsage(); System.exit(1); }
130 while (argIter.hasNext()) {
131 String arg = argIter.next();
132 if (arg.equals(
"--xml")) { writeNetworkXmlFile =
true; }
133 else if (arg.equals(
"--txt")) { writeNetworkTxtFile =
true; }
134 else if (arg.equals(
"--shp")) { writeNetworkShapeFile =
true; }
135 else if (arg.equals(
"--frc8")) { ignoreFrcType8 =
true; }
136 else if (arg.equals(
"--frc7N")) { ignoreFrcType7onewayN =
true; }
137 else if (arg.equals(
"--maxfrc2l")) {
139 try { maxFrcTypeForDoubleLaneLink = Integer.parseInt(argIter.next()); }
140 catch (
Exception e) { System.out.println(
"Cannot understand argument: --maxfrc2l " + arg);
printUsage(); System.exit(1); }
142 else if (arg.equals(
"--minsnc")) {
144 try { minSpeedForNormalCapacity = Integer.parseInt(argIter.next()); }
145 catch (
Exception e) { System.out.println(
"Cannot understand argument: --minsnc " + arg);
printUsage(); System.exit(1); }
147 else if (arg.equals(
"--radius")) {
149 try { expansionRadius = Double.parseDouble(argIter.next()); }
150 catch (
Exception e) { System.out.println(
"Cannot understand argument: --radius " + arg);
printUsage(); System.exit(1); }
152 else if (arg.equals(
"--offset")) {
154 try { linkSeparation =Double.parseDouble(argIter.next()); }
155 catch (
Exception e) { System.out.println(
"Cannot understand argument: --offset " + arg);
printUsage(); System.exit(1); }
157 else if (arg.equals(
"--uturn")) { removeUTurns =
true; }
158 else if (arg.equals(
"-h") || arg.equals(
"--help")) {
printUsage(); System.exit(0); }
159 else if (arg.startsWith(
"-")) { System.out.println(
"Unrecognized option " + arg); System.exit(1); }
163 nwShpFileName = argIter.next();
164 if (argIter.hasNext()) {
165 arg = argIter.next();
166 if (arg.endsWith(
".dbf")) {
168 if (argIter.hasNext()) {
169 arg = argIter.next();
170 if (arg.endsWith(
".shp")) {
173 mpDbfFileName = argIter.next();
174 if (argIter.hasNext()) {
175 outputDir = argIter.next();
183 else if (arg.endsWith(
".shp")) {
186 mpDbfFileName = argIter.next();
187 if (argIter.hasNext()) {
188 outputDir = argIter.next();
195 if (argIter.hasNext()) {
196 System.out.println(
"Too many arguments.");
211 if (mnShpFileName != null) {
214 if (!Double.isNaN(expansionRadius)) { mrModule.
expansionRadius = expansionRadius; }
215 if (!Double.isNaN(linkSeparation)) { mrModule.
linkSeparation = linkSeparation; }
220 if (!iter.hasNext()) {
221 System.out.println(
"Too few arguments.");
228 System.out.println();
229 System.out.println(
"TeleatlasParser");
230 System.out.println(
"Parsers Teleatlas databases into MATSim network data structure.");
231 System.out.println(
"Optional: It also writes a MATSim XML network file and/or a shape file of the data.");
232 System.out.println();
233 System.out.println(
"usage: TeleatlasParser [OPTIONS] jcShpFile nwShpFile [srDbfFile] [mnShpFile mpShpFile] [outputDirectory]");
234 System.out.println();
235 System.out.println(
"jcShpFile: Teleatlas Junction Shape File (typically called 'xyz________jc.shp')");
236 System.out.println(
"nwShpFile: Teleatlas network Shape File (typically called 'xyz________nw.shp')");
237 System.out.println(
"srDbfFile: Teleatlas speed restriction DBF File (typically called 'xyz________sr.dbf')");
238 System.out.println(
"mnShpFile: Teleatlas maneuver Shape File (typically called 'xyz________mn.shp')");
239 System.out.println(
"mpShpFile: Teleatlas maneuver paths DBF File (typically called 'xyz________mp.dbf')");
240 System.out.println(
"outputDirectory: Directory where output files (MATSim XML network file, ASCII files and shape files) are stored.");
241 System.out.println(
" default: ./output");
242 System.out.println(
" If writing option is set (see below) the files will be stored as:");
243 System.out.println(
" <outputDirectory>/output_network.xml.gz");
244 System.out.println(
" <outputDirectory>/output_links.shp (and related files)");
245 System.out.println(
" <outputDirectory>/nodes.txt");
246 System.out.println(
" <outputDirectory>/links.txt");
247 System.out.println(
" <outputDirectory>/linksET.txt");
248 System.out.println();
249 System.out.println(
"Options:");
250 System.out.println(
"--xml: If set, a MATSim XML network file will be written to <outputDirectory>/output_network.xml.gz.");
251 System.out.println(
"--txt: If set, three ASCII network files will be written to <outputDirectory>/nodes.txt, links.txt, resp. linksET.txt).");
252 System.out.println(
" These are useful for manual conversion with ESRI ArcGIS (ET GeoWizards plugin).");
253 System.out.println(
"--shp: If set, a network Shape file will be written to <outputDirectory>/output_links.shp");
254 System.out.println(
"--frc8: If set, links with FRC type = '8' will be ignored from the nwShpFile.");
255 System.out.println(
"--frc7N: If set, links with FRC type = '7' and ONEWAY = 'N' will be ignored from the nwShpFile.");
256 System.out.println(
"--maxfrc2l FRCtype:");
257 System.out.println(
" Defines, which links of the nwShpFile get 2 lanes per direction ('MAX FRC for 2 LANES').");
258 System.out.println(
" Teleatlas defines the number of lanes (LANES attribute of the nwShpFile) only for");
259 System.out.println(
" a few links. This option defines for links with LANES<'1' how many lanes will be set");
260 System.out.println(
" based on the FRC type. E.g. '--maxfrc2l 4' sets 2 lanes for FRC=[0-4] and 1 lane for FRC>4.");
261 System.out.println(
" default: '--maxfrc2l 3'");
262 System.out.println(
"--minsnc freespeed:");
263 System.out.println(
" Defines, which links of the nwShpFile get capacity[veh/h]=2000*#lanes ('MIN SPEED for NORMAL CAPACITY').");
264 System.out.println(
" Teleatlas does not define link capacities. This option sets capactities based on freespeed and");
265 System.out.println(
" derived number of lanes. E.g. '--minsnc 20'[km/h] sets capacity[veh/h]=2000*#lanes for freespeed>=20[km/h] and");
266 System.out.println(
" capacity[veh/h]=1000*#lanes for freespeed<20[km/h].");
267 System.out.println(
" default: '--minsnc 40'");
268 System.out.println(
"--radius NodeExpansionRadius:");
269 System.out.println(
" If [mnShpFile mpShpFile] are given, turn maneuvers will be created via expanding the corresponing node");
270 System.out.println(
" with virtual nodes. The option defines the radius on which the virtual nodes will be places around");
271 System.out.println(
" the expanded node. The unit of 'NodeExpansionRadius' depends on the projection of the input network.");
272 System.out.println(
" E.g. for WGS84, '--radius 0.00003'[degrees] suits well. '--radius 0' will place all virtual nodes at the same place,");
273 System.out.println(
" causing zero distance virtual links (for turn maneuvers).");
274 System.out.println(
" default: '--radius 0.00003'");
275 System.out.println(
"--offset NodeExpansionOffset:");
276 System.out.println(
" If [mnShpFile mpShpFile] are given, turn maneuvers will be created via expanding the corresponing node");
277 System.out.println(
" with virtual nodes. The option defines the offset against the position of the incident links of the");
278 System.out.println(
" expanded node. The unit of 'NodeExpansionOffset' depends on the projection of the input network.");
279 System.out.println(
" E.g. for WGS84, '--offset 0.0.000005'[degrees] suits well. '--offset 0' will place virtual nodes of an in- and");
280 System.out.println(
" out-link pair at the same place, causing zero distance virtual u-turn links (for turn maneuvers).");
281 System.out.println(
" default: '--offset 0.000005'");
282 System.out.println(
"--uturn: If set and if [mnShpFile mpShpFile] are given, no virtual u-turn links for an in- and out-link pair will be created.");
283 System.out.println(
"-h, --help: Displays this message.");
284 System.out.println();
285 System.out.println(
"----------------");
286 System.out.println(
"2009, matsim.org");
287 System.out.println();
void setFeatureGeneratorPrototype(final Class<? extends FeatureGenerator > prototype)
void run(final Network network)
static final void ensureNextElement(final Iterator< String > iter)
void run(Network network)
void run(final Network network)
void write(final String filename)
static NetworkTeleatlasAddManeuverRestrictions mrModule
static NetworkTeleatlasAddSpeedRestrictions srModule
static String mpDbfFileName
int maxFrcTypeForDoubleLaneLink
static String srDbfFileName
static NetworkReaderTeleatlas reader
static String mnShpFileName
static final Network convert()
static void main(String[] args)
static boolean writeNetworkShapeFile
static boolean writeNetworkTxtFile
static Network createNetwork()
final void printInfo(final String prefix)
static String jcShpFileName
static final void parseArguments(final String[] args)
final void printInfo(final String prefix)
static boolean writeNetworkXmlFile
static String nwShpFileName
void setWidthCalculatorPrototype(final Class<? extends WidthCalculator > prototype)
int minSpeedForNormalCapacity
static final void printSetting()
final void printInfo(final String prefix)
boolean ignoreFrcType7onewayN
static final void printUsage()
Iterator< String > iterator()