Hello Peter Karich,<br><br>First of all i wanted to thank you for this great framework!<br><br>I don't know if my topic existed before, because i am new to this list.<br><br>I'm currently trying to add height data for each node and edge.<br>
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).<br>I started to implement those features in GraphStorage like this:<br>
<br>public class GraphStorage implements Graph, Storable<GraphStorage>{<br> //...<br> protected final int E_NODEA, E_NODEB, E_LINKA, E_LINKB, E_DIST, E_FLAGS, E_GEO, E_HEIGHT_DIFF;<br> //...<br> protected final int N_EDGE_REF, N_LAT, N_LON, N_HEIGHT;<br>
//...<br><br> public GraphStorage(Directory dir) { //constructor<br> //...<br><br> E_NODEA = nextEdgeEntryIndex();<br> E_NODEB = nextEdgeEntryIndex();<br> E_LINKA = nextEdgeEntryIndex();<br> E_LINKB = nextEdgeEntryIndex();<br>
E_DIST = nextEdgeEntryIndex();<br> E_FLAGS = nextEdgeEntryIndex();<br> E_GEO = nextEdgeEntryIndex();<br> E_HEIGHT_DIFF = nextEdgeEntryIndex();<br><br> N_EDGE_REF = nextNodeEntryIndex();<br> N_LAT = nextNodeEntryIndex();<br>
N_LON = nextNodeEntryIndex();<br> N_HEIGHT = nextNodeEntryIndex();<br> <br> initNodeAndEdgeEntrySize();<br><br> //...<br><br> }<br> <br> //...<br><br> public void setNode(int index, double lat, double lon, double height) {<br>
ensureNodeIndex(index);<br> long tmp = (long) index * nodeEntrySize;<br> <br> nodes.setInt(tmp + N_LAT, Helper.degreeToInt(lat));<br> nodes.setInt(tmp + N_LON, Helper.degreeToInt(lon));<br> nodes.setInt(tmp + N_HEIGHT, Helper.doubleToInt(height)); //i always write like this<br>
<br> //...<br> }<br> <br> //...<br><br> private long writeEdge(int edge, int nodeThis, int nodeOther, int nextEdge, int nextEdgeOther,<br> double distance, double heightDiff, int flags) {<br> long edgePointer = (long) edge * edgeEntrySize;<br>
edges.setInt(edgePointer + E_NODEA, nodeThis);<br> edges.setInt(edgePointer + E_NODEB, nodeOther);<br> edges.setInt(edgePointer + E_LINKA, nextEdge);<br> edges.setInt(edgePointer + E_LINKB, nextEdgeOther);<br>
edges.setInt(edgePointer + E_DIST, distToInt(distance));<br> edges.setInt(edgePointer + E_HEIGHT_DIFF, Helper.doubleToInt(heightDiff)); //i always write like this<br> edges.setInt(edgePointer + E_FLAGS, flags);<br>
//...<br> }<br> //... <br><br>};<br><br>I also added a getter and setter for the height and heightDiff which shouldn't be important to this.<br>And i disabled contraction hierarchies for testing.<br><br>Now the problem:<br>
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.<br>
Is there smth. i have to take care of, else?<br>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 .<br>
<br>Is there anything i did wrong? Or is there anything i forgot to take care of?<br><br>Thanks in advance,<br>Andreas<br>