MATSIM
Static Public Member Functions | Static Private Member Functions | Static Private Attributes | List of all members
org.matsim.run.TeleAtlas2Network Class Reference

Static Public Member Functions

static final Network convert () throws Exception
 
static void main (String[] args) throws Exception
 

Static Private Member Functions

static final void printSetting ()
 
static final void parseArguments (final String[] args)
 
static final void ensureNextElement (final Iterator< String > iter)
 
static final void printUsage ()
 

Static Private Attributes

static NetworkReaderTeleatlas reader = null
 
static Network network = null
 
static String jcShpFileName = null
 
static String nwShpFileName = null
 
static NetworkTeleatlasAddSpeedRestrictions srModule = null
 
static String srDbfFileName = null
 
static NetworkTeleatlasAddManeuverRestrictions mrModule = null
 
static String mnShpFileName
 
static String mpDbfFileName
 
static String outputDir = "output"
 
static boolean writeNetworkXmlFile = false
 
static boolean writeNetworkTxtFile = false
 
static boolean writeNetworkShapeFile = false
 

Detailed Description

Definition at line 38 of file TeleAtlas2Network.java.

Member Function Documentation

◆ convert()

static final Network org.matsim.run.TeleAtlas2Network.convert ( ) throws Exception
static

Definition at line 65 of file TeleAtlas2Network.java.

References org.matsim.run.TeleAtlas2Network.network, org.matsim.run.TeleAtlas2Network.printSetting(), org.matsim.core.network.io.NetworkReaderTeleatlas.read(), org.matsim.core.network.algorithms.NetworkWriteAsTable.run(), org.matsim.core.network.algorithms.NetworkTeleatlasAddSpeedRestrictions.run(), org.matsim.core.network.algorithms.NetworkTeleatlasAddManeuverRestrictions.run(), org.matsim.utils.gis.matsim2esri.network.FeatureGeneratorBuilderImpl.setFeatureGeneratorPrototype(), org.matsim.utils.gis.matsim2esri.network.FeatureGeneratorBuilderImpl.setWidthCalculatorPrototype(), org.matsim.core.network.io.NetworkWriter.write(), and org.matsim.utils.gis.matsim2esri.network.Links2ESRIShape.write().

Referenced by org.matsim.run.TeleAtlas2Network.main().

65  {
66  System.out.println("conversion settings...");
67  printSetting();
68  System.out.println("done.");
69 
70  reader.read();
71  if (srModule != null) { srModule.run(network); }
72  if (mrModule != null) { mrModule.run(network); }
73 
74  if (writeNetworkXmlFile) {
75  System.out.println("writing xml file...");
76  new NetworkWriter(network).write(outputDir+"/output_network.xml.gz");
77  System.out.println("done.");
78  }
79  if (writeNetworkTxtFile) {
80  System.out.println("writing txt files...");
81  NetworkWriteAsTable nwat = new NetworkWriteAsTable(outputDir);
82  nwat.run(network);
83  System.out.println("done.");
84  }
86  System.out.println("writing shape file...");
87 // if (Gbl.getConfig() == null) { Gbl.createConfig(null); }
88 // Gbl.getConfig().global().setCoordinateSystem("WGS84");
89  FeatureGeneratorBuilderImpl builder = new FeatureGeneratorBuilderImpl(network, "WGS84");
90  builder.setFeatureGeneratorPrototype(LineStringBasedFeatureGenerator.class);
91  builder.setWidthCalculatorPrototype(LanesBasedWidthCalculator.class);
92  new Links2ESRIShape(network,outputDir+"/output_links.shp",builder).write();
93  System.out.println("done.");
94  }
95  return network;
96  }
static NetworkTeleatlasAddManeuverRestrictions mrModule
static NetworkTeleatlasAddSpeedRestrictions srModule
static NetworkReaderTeleatlas reader
Here is the call graph for this function:

◆ printSetting()

static final void org.matsim.run.TeleAtlas2Network.printSetting ( )
staticprivate

Definition at line 102 of file TeleAtlas2Network.java.

References org.matsim.core.network.algorithms.NetworkTeleatlasAddSpeedRestrictions.printInfo(), org.matsim.core.network.algorithms.NetworkTeleatlasAddManeuverRestrictions.printInfo(), and org.matsim.core.network.io.NetworkReaderTeleatlas.printInfo().

Referenced by org.matsim.run.TeleAtlas2Network.convert().

102  {
103  reader.printInfo(" ");
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);
111  }
static NetworkTeleatlasAddManeuverRestrictions mrModule
static NetworkTeleatlasAddSpeedRestrictions srModule
static NetworkReaderTeleatlas reader
Here is the call graph for this function:

◆ parseArguments()

static final void org.matsim.run.TeleAtlas2Network.parseArguments ( final String []  args)
staticprivate

Definition at line 117 of file TeleAtlas2Network.java.

References org.matsim.run.TeleAtlas2Network.ensureNextElement(), org.matsim.core.network.algorithms.NetworkTeleatlasAddManeuverRestrictions.expansionRadius, org.matsim.core.network.io.NetworkReaderTeleatlas.ignoreFrcType7onewayN, org.matsim.core.network.io.NetworkReaderTeleatlas.ignoreFrcType8, org.matsim.core.utils.misc.ArgumentParser.iterator(), org.matsim.core.network.algorithms.NetworkTeleatlasAddManeuverRestrictions.linkSeparation, org.matsim.core.network.io.NetworkReaderTeleatlas.maxFrcTypeForDoubleLaneLink, org.matsim.core.network.io.NetworkReaderTeleatlas.minSpeedForNormalCapacity, org.matsim.run.TeleAtlas2Network.printUsage(), and org.matsim.core.network.algorithms.NetworkTeleatlasAddManeuverRestrictions.removeUTurns.

Referenced by org.matsim.run.TeleAtlas2Network.main().

117  {
118  // reader params
119  boolean ignoreFrcType8 = false;
120  boolean ignoreFrcType7onewayN = false;
121  int maxFrcTypeForDoubleLaneLink = Integer.MIN_VALUE;
122  int minSpeedForNormalCapacity = Integer.MAX_VALUE;
123  // mrModule params
124  boolean removeUTurns = false;
125  double expansionRadius = Double.NaN;
126  double linkSeparation = Double.NaN;
127 
128  if (args.length == 0) { System.out.println("Too few arguments."); printUsage(); System.exit(1); }
129  Iterator<String> argIter = new ArgumentParser(args).iterator();
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")) {
138  ensureNextElement(argIter);
139  try { maxFrcTypeForDoubleLaneLink = Integer.parseInt(argIter.next()); }
140  catch (Exception e) { System.out.println("Cannot understand argument: --maxfrc2l " + arg); printUsage(); System.exit(1); }
141  }
142  else if (arg.equals("--minsnc")) {
143  ensureNextElement(argIter);
144  try { minSpeedForNormalCapacity = Integer.parseInt(argIter.next()); }
145  catch (Exception e) { System.out.println("Cannot understand argument: --minsnc " + arg); printUsage(); System.exit(1); }
146  }
147  else if (arg.equals("--radius")) {
148  ensureNextElement(argIter);
149  try { expansionRadius = Double.parseDouble(argIter.next()); }
150  catch (Exception e) { System.out.println("Cannot understand argument: --radius " + arg); printUsage(); System.exit(1); }
151  }
152  else if (arg.equals("--offset")) {
153  ensureNextElement(argIter);
154  try { linkSeparation =Double.parseDouble(argIter.next()); }
155  catch (Exception e) { System.out.println("Cannot understand argument: --offset " + arg); printUsage(); System.exit(1); }
156  }
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); }
160  else {
161  jcShpFileName = arg;
162  ensureNextElement(argIter);
163  nwShpFileName = argIter.next();
164  if (argIter.hasNext()) {
165  arg = argIter.next(); // dbf, shp&dbf, dir
166  if (arg.endsWith(".dbf")) {
167  srDbfFileName = arg;
168  if (argIter.hasNext()) {
169  arg = argIter.next(); // shp&dbf, dir
170  if (arg.endsWith(".shp")) {
171  ensureNextElement(argIter);
172  mnShpFileName = arg;
173  mpDbfFileName = argIter.next();
174  if (argIter.hasNext()) { // dir
175  outputDir = argIter.next();
176  }
177  }
178  else {
179  outputDir = arg;
180  }
181  }
182  }
183  else if (arg.endsWith(".shp")) {
184  ensureNextElement(argIter);
185  mnShpFileName = arg;
186  mpDbfFileName = argIter.next();
187  if (argIter.hasNext()) { // dir
188  outputDir = argIter.next();
189  }
190  }
191  else {
192  outputDir = arg;
193  }
194  }
195  if (argIter.hasNext()) {
196  System.out.println("Too many arguments.");
197  printUsage();
198  System.exit(1);
199  }
200  }
201  }
202  // init the reader
203  reader = new NetworkReaderTeleatlas(network,jcShpFileName,nwShpFileName);
204  reader.ignoreFrcType8 = ignoreFrcType8;
205  reader.ignoreFrcType7onewayN = ignoreFrcType7onewayN;
206  if (maxFrcTypeForDoubleLaneLink != Integer.MIN_VALUE) { reader.maxFrcTypeForDoubleLaneLink = maxFrcTypeForDoubleLaneLink; }
207  if (minSpeedForNormalCapacity != Integer.MAX_VALUE) { reader.minSpeedForNormalCapacity = minSpeedForNormalCapacity; }
208  // init the srModule
209  if (srDbfFileName != null) { srModule = new NetworkTeleatlasAddSpeedRestrictions(srDbfFileName); }
210  // init mrModule
211  if (mnShpFileName != null) {
212  mrModule = new NetworkTeleatlasAddManeuverRestrictions(mnShpFileName,mpDbfFileName);
213  mrModule.removeUTurns = removeUTurns;
214  if (!Double.isNaN(expansionRadius)) { mrModule.expansionRadius = expansionRadius; }
215  if (!Double.isNaN(linkSeparation)) { mrModule.linkSeparation = linkSeparation; }
216  }
217  }
static final void ensureNextElement(final Iterator< String > iter)
static NetworkTeleatlasAddManeuverRestrictions mrModule
static NetworkTeleatlasAddSpeedRestrictions srModule
static NetworkReaderTeleatlas reader
Here is the call graph for this function:

◆ ensureNextElement()

static final void org.matsim.run.TeleAtlas2Network.ensureNextElement ( final Iterator< String >  iter)
staticprivate

Definition at line 219 of file TeleAtlas2Network.java.

References org.matsim.run.TeleAtlas2Network.printUsage().

Referenced by org.matsim.run.TeleAtlas2Network.parseArguments().

219  {
220  if (!iter.hasNext()) {
221  System.out.println("Too few arguments.");
222  printUsage();
223  System.exit(1);
224  }
225  }
Here is the call graph for this function:

◆ printUsage()

static final void org.matsim.run.TeleAtlas2Network.printUsage ( )
staticprivate

Definition at line 227 of file TeleAtlas2Network.java.

Referenced by org.matsim.run.TeleAtlas2Network.ensureNextElement(), and org.matsim.run.TeleAtlas2Network.parseArguments().

227  {
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();
288  }

◆ main()

static void org.matsim.run.TeleAtlas2Network.main ( String []  args) throws Exception
static

Definition at line 294 of file TeleAtlas2Network.java.

References org.matsim.run.TeleAtlas2Network.convert(), org.matsim.core.network.NetworkUtils.createNetwork(), and org.matsim.run.TeleAtlas2Network.parseArguments().

294  {
295 // // example arguments:
296 // // usage: TeleatlasParser [OPTIONS] jcShpFile nwShpFile [srDbfFile] [mnShpFile mpShpFile] [outputDirectory]
297 // String options = "--xml --txt --shp --frc8 --frc7N --maxfrc2l 3 --minsnc 40 --radius 0.000030 --offset 0.000005 --uturn ";
298 // String jcShpFile = "../../input/teleatlas/jc_zurich.shp ";
299 // String nwShpFile = "../../input/teleatlas/nw_zurich.shp ";
300 // String srDbfFile = "../../input/teleatlas/cheche________sr.dbf ";
301 // String mnShpFile = "../../input/teleatlas/cheche________mn.shp ";
302 // String mpShpFile = "../../input/teleatlas/cheche________mp.dbf ";
303 // String outDir = "../../output ";
304 // String str = options+jcShpFile+nwShpFile+srDbfFile+mnShpFile+mpShpFile+outDir;
305 // str = str.trim();
306 // args = str.split(" ");
307 
308  network = NetworkUtils.createNetwork();
309  parseArguments(args);
310  convert();
311  // TODO balmermi: more options
312  // transform // -t WGS84toCH1903LV03
313  // clean network // -c
314  // network thinning // -t
315  }
static final void parseArguments(final String[] args)
Here is the call graph for this function:

Member Data Documentation

◆ reader

NetworkReaderTeleatlas org.matsim.run.TeleAtlas2Network.reader = null
staticprivate

Definition at line 44 of file TeleAtlas2Network.java.

◆ network

Network org.matsim.run.TeleAtlas2Network.network = null
staticprivate

Definition at line 45 of file TeleAtlas2Network.java.

Referenced by org.matsim.run.TeleAtlas2Network.convert().

◆ jcShpFileName

String org.matsim.run.TeleAtlas2Network.jcShpFileName = null
staticprivate

Definition at line 46 of file TeleAtlas2Network.java.

◆ nwShpFileName

String org.matsim.run.TeleAtlas2Network.nwShpFileName = null
staticprivate

Definition at line 47 of file TeleAtlas2Network.java.

◆ srModule

NetworkTeleatlasAddSpeedRestrictions org.matsim.run.TeleAtlas2Network.srModule = null
staticprivate

Definition at line 49 of file TeleAtlas2Network.java.

◆ srDbfFileName

String org.matsim.run.TeleAtlas2Network.srDbfFileName = null
staticprivate

Definition at line 50 of file TeleAtlas2Network.java.

◆ mrModule

NetworkTeleatlasAddManeuverRestrictions org.matsim.run.TeleAtlas2Network.mrModule = null
staticprivate

Definition at line 52 of file TeleAtlas2Network.java.

◆ mnShpFileName

String org.matsim.run.TeleAtlas2Network.mnShpFileName
staticprivate

Definition at line 53 of file TeleAtlas2Network.java.

◆ mpDbfFileName

String org.matsim.run.TeleAtlas2Network.mpDbfFileName
staticprivate

Definition at line 54 of file TeleAtlas2Network.java.

◆ outputDir

String org.matsim.run.TeleAtlas2Network.outputDir = "output"
staticprivate

Definition at line 56 of file TeleAtlas2Network.java.

◆ writeNetworkXmlFile

boolean org.matsim.run.TeleAtlas2Network.writeNetworkXmlFile = false
staticprivate

Definition at line 57 of file TeleAtlas2Network.java.

◆ writeNetworkTxtFile

boolean org.matsim.run.TeleAtlas2Network.writeNetworkTxtFile = false
staticprivate

Definition at line 58 of file TeleAtlas2Network.java.

◆ writeNetworkShapeFile

boolean org.matsim.run.TeleAtlas2Network.writeNetworkShapeFile = false
staticprivate

Definition at line 59 of file TeleAtlas2Network.java.


The documentation for this class was generated from the following file: