Global Positioning System Reference
In-Depth Information
OSM <way> s (hopefully links) by their network feature
int feature = setFeature( way.getElementsByTagName("tag"));
with the feature being the index to one of the hard-coded values:
private final String[] linkFeatures
= { "highway.motorway", "railway.rail" ,"waterway.river" }
Then the way IDs are collected from the file,
List<Integer> nodeIDs
= getWaypoints( way.getElementsByTagName("nd"));
node's ( GeoPoint s) are looked up and stored in another list, 7
List<Position> nodePosition = getNodeList( nodeIDs );
and all from and to node ID s (both ends of a link) are stored in a set:
Set<Integer> linkNodes = new HashSet<Integer>();
The collected information is used to create a Link as an ordered list of
Position s and a feature:
Link link = new Link( feature, nodePosition );
After the link has been created, only the from and to nodes are saved, while
the intermediate points strip off their IDs and loose their addressability by
ID! Finally, all links of the file are collected in another set:
Set<Link> osmLinks = new HashSet<Link>();
After all links have been collected, the nodeMap is significantly reduced
to the outer nodeIDs of the links:
Set<Integer> nodes = nodeMap.keySet();
nodes.retainAll( linkNodes );
to hold all addressable nodes reachable via destination and ID or via geo-
coordinates (spatial index) to node.
The whole idea of a clean link collection is to restrict the map to its
maneuver points. These are the only points where the user (or driver) can
actually make a choice to navigate to one of the connected maneuver points.
Building a graph is the way to model the connectivity. There are endless
ways to build a ((non)directed, (non)planar) graph. The idea is always
the same: Each node should be accessible as a from node of a routing
algorithm. Once the node has been identified it can be looked up in the
7 Note that Collection variables can be easily printed by adding a simple println
statement for a deeper understanding.
 
Search WWH ::




Custom Search