Global Positioning System Reference
In-Depth Information
To get a preview of what's coming next, the main method of
roaf.book.navigation.NavigableMap should be hard coded to the file
created earlier ../resources/gps/GER/germany.net.osm to print a sum-
mary to System.out .
The NavigableMap has two constructors to read the network data file
or network DOM document 5 after creation. This represents the start-up
procedure, when turning on a navigation system and reading the persistent
map from an external media into the software. The duration depends on
the size of the network.
The methods
parseDOM( org.w3c.dom.Document osmDOM )
parseRootNode( org.w3c.dom.Node root )
extract OSM XML child nodes from the file.
A node ID has the character of a look-up key, which is the structure of a
sequentially geocoded file (OSM, GDF, etc.). The <node> s at the beginning
of the file actually hold the geographic coordinates, while the <way> s only
make use of the IDs as references. In Java, this mechanism is achieved by
using a Map collection:
Map<Integer, Position> nodeMap
= new HashMap<Integer, Position>()>
Note that Position is an interface and Java collections work with object
references. So the number of position objects remains constant throughout
the NavigableMap 's lifetime. After all coordinates have been collected in the
nodeMap ,
lookup ID (key) -> nodeMap -> retrieve coordinates (value)
/ \
< nodeID , Position >
-------+---------
: :
129957469=(48.3703063N/10.884524W)
495407=(50.8050291N/9.5378884W)
-561=(49.4437887N/8.5421011W)
3693=(50.3010783N/8.8246156W)
: :
the OSM way s can be composed with node IDs and can abstract the actual
map geometry. The geometry layer is important for drawing, but as it will
turn out, not really needed for routing.
5 See \XML and Java in a Nutshell" on page 50.
 
Search WWH ::




Custom Search