[GraphHopper] Height-Data
Andreas Fischer
fischer.andreas.atf at googlemail.com
Tue Jun 11 09:32:04 UTC 2013
Hello Peter Karich,
First of all i wanted to thank you for this great framework!
I don't know if my topic existed before, because i am new to this list.
I'm currently trying to add height data for each node and edge.
The node should have it's actual geo height and an edge should have the
delta height between the two tower nodes (to safe performance while
routing).
I started to implement those features in GraphStorage like this:
public class GraphStorage implements Graph, Storable<GraphStorage>{
//...
protected final int E_NODEA, E_NODEB, E_LINKA, E_LINKB, E_DIST, E_FLAGS,
E_GEO, E_HEIGHT_DIFF;
//...
protected final int N_EDGE_REF, N_LAT, N_LON, N_HEIGHT;
//...
public GraphStorage(Directory dir) { //constructor
//...
E_NODEA = nextEdgeEntryIndex();
E_NODEB = nextEdgeEntryIndex();
E_LINKA = nextEdgeEntryIndex();
E_LINKB = nextEdgeEntryIndex();
E_DIST = nextEdgeEntryIndex();
E_FLAGS = nextEdgeEntryIndex();
E_GEO = nextEdgeEntryIndex();
E_HEIGHT_DIFF = nextEdgeEntryIndex();
N_EDGE_REF = nextNodeEntryIndex();
N_LAT = nextNodeEntryIndex();
N_LON = nextNodeEntryIndex();
N_HEIGHT = nextNodeEntryIndex();
initNodeAndEdgeEntrySize();
//...
}
//...
public void setNode(int index, double lat, double lon, double height) {
ensureNodeIndex(index);
long tmp = (long) index * nodeEntrySize;
nodes.setInt(tmp + N_LAT, Helper.degreeToInt(lat));
nodes.setInt(tmp + N_LON, Helper.degreeToInt(lon));
nodes.setInt(tmp + N_HEIGHT, Helper.doubleToInt(height)); //i always
write like this
//...
}
//...
private long writeEdge(int edge, int nodeThis, int nodeOther, int
nextEdge, int nextEdgeOther,
double distance, double heightDiff, int flags) {
long edgePointer = (long) edge * edgeEntrySize;
edges.setInt(edgePointer + E_NODEA, nodeThis);
edges.setInt(edgePointer + E_NODEB, nodeOther);
edges.setInt(edgePointer + E_LINKA, nextEdge);
edges.setInt(edgePointer + E_LINKB, nextEdgeOther);
edges.setInt(edgePointer + E_DIST, distToInt(distance));
edges.setInt(edgePointer + E_HEIGHT_DIFF,
Helper.doubleToInt(heightDiff)); //i always write like this
edges.setInt(edgePointer + E_FLAGS, flags);
//...
}
//...
};
I also added a getter and setter for the height and heightDiff which
shouldn't be important to this.
And i disabled contraction hierarchies for testing.
Now the problem:
If i build the graph with ./graphhopper.sh and the new compiled .jar, the
step "flushing graph" takes forever! I recognized that it takes much time
while generating the locationIndex file of the graph because at this time
all the other graph files are already created.
Is there smth. i have to take care of, else?
Also: The graph itself is usable on the phone, but any calculated path ends
up broken. A 5km long path is around 30km long and doesn't make any sense.
The blue lines are drawn all over the map. It totally goes nuts :P .
Is there anything i did wrong? Or is there anything i forgot to take care
of?
Thanks in advance,
Andreas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/graphhopper/attachments/20130611/fffa80ea/attachment.html>
More information about the GraphHopper
mailing list