[GraphHopper] storing an additional byte field in the graph

Peter K peathal at yahoo.de
Thu Nov 7 14:13:30 UTC 2013


The default behaviour is indeed: edgeEntryIndex += 4 ... just do =+1 
then as you suggested. Then access this byte field via the 
edgeEntrySize*edgeId+INDEX and the method edges.getBytes. To make 
getBytes working you need to disable the following optimization in 
GHDirectory:
put("edges", DAType.RAM_INT_STORE);

Which means: for 'edges' (and others) use an integer based DataAccess 
implementation as it is faster. But for them the getBytes is currently 
not implemented (pull requests welcome!) so you need to use a byte 
based DataAccess - e.g. just comment out the optimization for edges.

Regards,
Peter.

> Hi Peter,
>
> For some dedicated application, I want to store an additional byte
> field in every edge.
> I have understood the mechanism for declaring fields, and implemented
> something to handle byte fields.
>
> My point is that the underlying DataStorage do not seem to tolerate
> that int are not aligned with the boundaries of their internal
> segments. As such, I am obliged to represent my field as an int
> instead of a single byte to ensure that the int are not crossing
> boundaries of segments. I did not find any other idea to maintain the
> alignment, since I did not see any API that I could call to maintain
> this alignment from outside the DataStorage.
>
> This makes me a little bit sad because of wasted space.
> Maybe you have a suggestion for me?
>
> --
> *Renaud De Landtsheer, Ir, Phd*
> Sr R&D Engineer
> CETIC
> Rue des Frères Wright, 29/3
> B-6041 Charleroi
> Phone: +32 71 490 754
>
>
>
>
> _______________________________________________
> GraphHopper mailing list
> GraphHopper at openstreetmap.org
> https://lists.openstreetmap.org/listinfo/graphhopper





More information about the GraphHopper mailing list