public class OSMReader extends Object implements DataReader
1. a) Reads ways from OSM file and stores all associated node ids in osmNodeIdToInternalNodeMap. If a
node occurs once it is a pillar node and if more it is a tower node, otherwise
osmNodeIdToInternalNodeMap returns EMPTY.
1. b) Reads relations from OSM file. In case that the relation is a route relation, it stores
specific relation attributes required for routing into osmWayIdToRouteWeightMap for all the ways
of the relation.
2.a) Reads nodes from OSM file and stores lat+lon information either into the intermediate data structure for the pillar nodes (pillarLats/pillarLons) or, if a tower node, directly into the graphStorage via setLatitude/setLongitude. It can also happen that a pillar node needs to be transformed into a tower node e.g. via barriers or different speed values for one way.
2.b) Reads ways from OSM file and creates edges while calculating the speed etc from the OSM tags. When creating an edge the pillar node information from the intermediate data structure will be stored in the way geometry of that edge.
| Modifier and Type | Field and Description |
|---|---|
protected static int |
EMPTY_NODE |
protected static int |
PILLAR_NODE |
protected PillarInfo |
pillarInfo |
protected static int |
TOWER_NODE |
protected long |
zeroCounter |
| Constructor and Description |
|---|
OSMReader(GraphHopperStorage ghStorage) |
| Modifier and Type | Method and Description |
|---|---|
Collection<OSMTurnRelation.TurnCostTableEntry> |
analyzeTurnRelation(FlagEncoder encoder,
OSMTurnRelation turnRelation) |
Collection<OSMTurnRelation.TurnCostTableEntry> |
analyzeTurnRelation(OSMTurnRelation turnRelation) |
protected void |
finishedReading() |
Date |
getDataDate() |
protected double |
getElevation(ReaderNode node) |
int |
getInternalNodeIdOfOsmNode(long nodeOsmId) |
protected com.carrotsearch.hppc.LongLongMap |
getNodeFlagsMap() |
protected LongIntMap |
getNodeMap()
Maps OSM IDs (long) to internal node IDs (int)
|
long |
getOsmIdOfInternalEdge(int edgeId) |
protected OSMInput |
openOsmInputFile(File osmFile) |
void |
processRelation(ReaderRelation relation) |
void |
readGraph() |
void |
setCreateStorage(boolean createStorage)
Per default the storage used in this OSMReader is uninitialized and created i.e.
|
OSMReader |
setElevationProvider(ElevationProvider eleProvider) |
DataReader |
setFile(File osmFile) |
DataReader |
setSmoothElevation(boolean smoothElevation) |
OSMReader |
setWayPointMaxDistance(double maxDist) |
OSMReader |
setWorkerThreads(int numOfWorkers) |
protected void |
storeOsmWayID(int edgeId,
long osmWayId)
Stores only osmWayIds which are required for relations
|
String |
toString() |
protected static final int EMPTY_NODE
protected static final int PILLAR_NODE
protected static final int TOWER_NODE
protected long zeroCounter
protected PillarInfo pillarInfo
public OSMReader(GraphHopperStorage ghStorage)
public void readGraph()
throws IOException
readGraph in interface DataReaderIOExceptionprotected OSMInput openOsmInputFile(File osmFile) throws XMLStreamException, IOException
XMLStreamExceptionIOExceptionpublic void processRelation(ReaderRelation relation)
public Collection<OSMTurnRelation.TurnCostTableEntry> analyzeTurnRelation(OSMTurnRelation turnRelation)
public Collection<OSMTurnRelation.TurnCostTableEntry> analyzeTurnRelation(FlagEncoder encoder, OSMTurnRelation turnRelation)
public long getOsmIdOfInternalEdge(int edgeId)
public int getInternalNodeIdOfOsmNode(long nodeOsmId)
protected double getElevation(ReaderNode node)
protected void storeOsmWayID(int edgeId,
long osmWayId)
protected void finishedReading()
protected LongIntMap getNodeMap()
protected com.carrotsearch.hppc.LongLongMap getNodeFlagsMap()
public OSMReader setWayPointMaxDistance(double maxDist)
setWayPointMaxDistance in interface DataReaderpublic DataReader setSmoothElevation(boolean smoothElevation)
setSmoothElevation in interface DataReaderpublic OSMReader setWorkerThreads(int numOfWorkers)
setWorkerThreads in interface DataReaderpublic OSMReader setElevationProvider(ElevationProvider eleProvider)
setElevationProvider in interface DataReaderpublic DataReader setFile(File osmFile)
setFile in interface DataReaderpublic Date getDataDate()
getDataDate in interface DataReaderpublic void setCreateStorage(boolean createStorage)
Copyright © 2012–2019. All rights reserved.