Package com.graphhopper.reader.osm
Class WaySegmentParser
java.lang.Object
com.graphhopper.reader.osm.WaySegmentParser
This class parses a given OSM file and splits OSM ways into 'segments' at all intersections (or 'junctions').
Intersections can be either crossings of different OSM ways or duplicate appearances of the same node within one
way (when the way contains a loop). Furthermore, this class creates artificial segments at certain nodes. It
also provides several hooks/callbacks to customize the processing of nodes, ways and relations.
The OSM file is read twice. The first time we ignore OSM nodes and only determine the OSM node IDs at which accepted ways are intersecting. During the second pass we split the OSM ways at intersections, introduce the artificial segments and pass the way information along with the corresponding nodes to a given callback.
We assume a strict order of the OSM file: nodes, ways, then relations.
The main difficulty is that the OSM ID range is very large (64bit integers) and to be able to provide the full
node information for each segment we have to efficiently store the node data temporarily. This is addressed by
OSMNodeData
.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
static interface
static interface
static interface
static interface
static interface
-
Method Summary
Modifier and TypeMethodDescriptionprotected OSMInput
openOsmInputFile
(File osmFile, SkipOptions skipOptions) void
-
Method Details
-
readOSM
- Parameters:
osmFile
- the OSM file to parse, supported formats include .osm.xml, .osm.gz and .xml.pbf
-
getTimestamp
- Returns:
- the timestamp read from the OSM file, or null if nothing was read yet
-
openOsmInputFile
protected OSMInput openOsmInputFile(File osmFile, SkipOptions skipOptions) throws XMLStreamException, IOException - Throws:
XMLStreamException
IOException
-