Global Positioning System Reference
In-Depth Information
TheJavaTutorial>EssentialClasses>RegularExpressions
This lesson explains how to use the java.util.regex API
for pattern matching with regular expressions. . . . Regular ex-
pressions are a way to describe a set of strings based on com-
mon characteristics shared by each string in the set. They can
be used to search, edit, or manipulate text and data.
Program Usage
The OSMparser.java file can be found in the default package of the book/src
folder, and the compiled class file can be copied to any folder and invoked
as follows:
java OSMparser -rx path\in.osm -wx path\out.osm ...
1: ... -clean
clean file from attributes and lines not of interest.
2: ... -xlines regEx
delete all lines matching the regular expression.
3: ... -xelements regEx (complement to -felements)
delete all elements matching the regular expression.
4: ... -felements regEx (complement to -xelements)
filter all elements matching the regular expression.
5: ... -xways regEx
delete all ways matching the regular expression.
With the command line below, the delivery unzipped in two and one-
half hours (see 88) can actually be reduced by 49%|to 137 minutes. Now
you can see why batch automation is vital. The process of downloading,
unzipping, and cleaning for a country like Germany already takes about
six hours (see Table 7.4).
java OSMparser -rx germany.osm -wx germany.clean.osm -clean
The program collects some statistics on the fly and provides a short
overview:
read: germany.osm
write: germany.clean.osm
starting -clean at Sat Nov 13 14:20:00 CET 2010
start parsing germany.osm
statistics germany.osm <> germany.clean.osm
lines: 209718750 <> 198429239
nodes: 64721366 <> 64721366
ways: 8929165 <> 8929165
relations: 134531 <> 134531
ending -clean at Sat Nov 13 16:36:26 CET 2010
 
Search WWH ::




Custom Search