Global Positioning System Reference
In-Depth Information
By invoking the batch
../products/GER/networks> osm2net germany
the network file will be created and the links can be identified in JOSM.
Program design. The splitting of ways into links can be achieved using
the
OSMparser
. It might be tempting to add this feature to the parser,
but it could get confusing for map engineers. Map compilation teams can
be separated into developers and producers to operate with a given set of
well-known tools. A producer usually doesn't have time to deal with source
codes and needs clear semantics for the command lines. The parser has a
clear domain and should not be misused to compile links. Nevertheless,
the link compiler is derived (or it could also be inherited) from the parser
and has a similar architecture:
The parser
parseArguments(args)
parses the list of
key.value
pairs
into
wayFeatures =
{ "railway.rail","highway.motorway","waterway.river" }
wayFeatures.length = 3
where the length defines the number of networks and is utilized to create
a list of ways as sequential collection node IDs:
List< List <Integer> >[]
ways = new ArrayList[ wayFeatures.length ];
ways[i] = new ArrayList<List<Integer>>();
with ways[0] = railway network etc.
All OSM
ID
s are collected in
private Map<Integer, Occurrences>[] nodeDistribution
= new HashMap[ wayFeatures.length ];
A
Map<Key,Value>
is a collection of keys without duplicates and associates
(or maps) objects with keys. This structure holds for the OSM format,
where each node has a unique ID with no specific position in a sequence.
The
nodeDistribution
represents a lookup table to look up a value by a
key. The idea is to store all of the
<way>
's
<node>
is as keys and to count their
occurrences. The class
Occurrences
is a wrapper object for a primitive
int
as a counter.
While
parseOSM()
is the central method of the parser, the link compiler
only uses this method to read the ways into RAM. Note that the link
compiler does not use the real-world coordinates
(lat,lon)
. The idea is
to create links by processing the node IDs without any knowledge of their
(relative) geographic location or any other node attribute. All nodes are
simply transferred to the output file and all relations are ignored and not
written to the output.
Search WWH ::
Custom Search