<html><body><div style="color:#000; background-color:#fff; font-family:Courier New, courier, monaco, monospace, sans-serif;font-size:8pt"><div><span style="background-color: transparent; font-size: 8pt;">Thanks everybody for your comments.</span><br></div><div style="color: rgb(0, 0, 0); font-size: 11px; font-family: 'Courier New', courier, monaco, monospace, sans-serif; background-color: transparent; font-style: normal;"><span style="background-color: transparent; font-size: 8pt;"><br></span></div><div style="background-color: transparent;">At the moment I would like to be able to blacklist both nodes and edges, so I will stick with the ExtendedStorage.</div><div style="background-color: transparent;"><br></div><div style="background-color: transparent; color: rgb(0, 0, 0); font-size: 11px; font-family: 'Courier New', courier, monaco, monospace, sans-serif; font-style: normal;">I have hacked an implementation for blacklisting nodes, but there are a
couple of things which are not clear to me.</div><div style="background-color: transparent;"><br></div><div style="background-color: transparent;">I created a class OSMReaderWithOsmIds which overrides addNode:</div><div style="background-color: transparent;"><br></div><div style="background-color: transparent;"> @Override</div><div style="background-color: transparent;"> boolean addNode(OSMNode node ){</div><div style="background-color: transparent;"><span class="Apple-tab-span" style="white-space:pre"> </span>if (super.addNode(node)){</div><div style="background-color: transparent;"><span class="Apple-tab-span" style="white-space:pre"> </span> int nodeId=super.getNodeMap().get(node.id);</div><div style="background-color: transparent;">(A) if (nodeId>0) {</div><div style="background-color: transparent;"> <span class="Apple-tab-span"
style="white-space:pre"> </span>((OsmIdsExtendedStorage)getGraphStorage().</div><div style="background-color: transparent; color: rgb(0, 0, 0); font-size: 11px; font-family: 'Courier New', courier, monaco, monospace, sans-serif; font-style: normal;"> getExtendedStorage()).<span style="background-color: transparent;">setNodeOsmId(nodeId, node.getId());</span></div><div style="background-color: transparent;"><span class="Apple-tab-span" style="background-color: transparent; font-size: 8pt; white-space: pre;"> </span><span style="background-color: transparent; font-size: 8pt;"> }</span></div><div style="background-color: transparent;"><span class="Apple-tab-span" style="white-space:pre"> </span> return true;</div><div style="background-color: transparent;"><span class="Apple-tab-span" style="white-space:pre"> </span>} else</div><div style="background-color:
transparent;"><span class="Apple-tab-span" style="white-space:pre"> </span> return false;</div><div style="background-color: transparent;"> }</div><div style="background-color: transparent;"><br></div><div style="background-color: transparent;"><br></div><div style="background-color: transparent;">where OsmIdsExtendedStorage has:</div><div style="background-color: transparent;"><br></div><div style="background-color: transparent;"> public int getEntryIndex(int nodeIndex){</div><div style="background-color: transparent;"> <span class="Apple-tab-span" style="white-space:pre"> </span>return graph.getAdditionalNodeField(nodeIndex);</div><div style="background-color: transparent;"> }</div><div style="background-color: transparent;"><br></div><div style="background-color: transparent;"> public int createNewEntry(int nodeIndex){</div><div style="background-color: transparent;">
<span class="Apple-tab-span" style="white-space:pre"> </span> // create new entry</div><div style="background-color: transparent;"> int newEntryIndex = count;</div><div style="background-color: transparent;"> count++;</div><div style="background-color: transparent;"> ensureEntryIndex(newEntryIndex);</div><div style="background-color: transparent;">(B) graph.setAdditionalNodeField(nodeIndex, newEntryIndex);</div><div style="background-color: transparent;"> return newEntryIndex;</div><div style="background-color: transparent;"> }</div><div style="background-color: transparent;"><br></div><div style="background-color: transparent;"> public void setNodeOsmId(int nodeIndex,long osmId){</div><div style="background-color: transparent;"><span class="Apple-tab-span" style="white-space:pre"> </span>int
entryIdx=getEntryIndex(nodeIndex);</div><div style="background-color: transparent;"><span class="Apple-tab-span" style="white-space:pre"> </span>if (entryIdx==NO_ENTRY){</div><div style="background-color: transparent;"><span style="background-color: transparent; font-size: 8pt;"> </span><span class="Apple-tab-span" style="background-color: transparent; font-size: 8pt; white-space: pre;"> </span> <span style="background-color: transparent; font-size: 8pt;">int newEntryIndex =createNewEntry(nodeIndex);</span><br></div><div style="background-color: transparent;"> // now populate the entry</div><div style="background-color: transparent;"> dataAccess.setBytes(newEntryIndex*entrySize,BitUtil.BIG.fromLong(osmId),entrySize);</div><div style="background-color: transparent;"><span class="Apple-tab-span" style="white-space:pre">
</span>}</div><div style="background-color: transparent;"> }</div><div style="background-color: transparent;"><br></div><div style="background-color: transparent;">The first problem I have is that when the nodeId is from a tower node, the nodeId (A) is negative and I can not use this value in <span style="background-color: transparent; font-size: 8pt;">graph.setAdditionalNodeField() (B). I dont know if this is intended (i.e. graph.setAdditionalNodeField can only be used on pillar nodes) or it is that I am using it incorrectly)</span></div><div style="background-color: transparent;"><br></div><div style="background-color: transparent;">Another problem is that I don't see graph.setAdditionalEdgeField, which I believe i need for storing the OSM id of an edge . I guess I will just try to implement it</div><div style="background-color: transparent;"><br></div><div style="background-color: transparent;">Last problem (for now ;) ) is that we
can store only one int in setAdditionalNodeField, but I would like to use both the TurnCostStorage and the OsmIdsExtendedStorage. I have the impression that one way to achieve it would be to allocate for the additionalNodeField several ints (one per extended storage) instead of just one. Or is there a better way?</div><div style="background-color: transparent;"> </div><div style="background-color: transparent;">Thanks </div><div style="background-color: transparent;">Bruno</div><div><br></div><div style="color: rgb(0, 0, 0); font-size: 11px; font-family: 'Courier New', courier, monaco, monospace, sans-serif; background-color: transparent; font-style: normal;"><br></div><div style="color: rgb(0, 0, 0); font-size: 11px; font-family: 'Courier New', courier, monaco, monospace, sans-serif; background-color: transparent; font-style: normal;"><br></div><div style="color: rgb(0, 0, 0); font-size: 11px; font-family: 'Courier New', courier, monaco,
monospace, sans-serif; background-color: transparent; font-style: normal;"><br></div><div style="color: rgb(0, 0, 0); font-size: 11px; font-family: 'Courier New', courier, monaco, monospace, sans-serif; background-color: transparent; font-style: normal;"><br></div> <div style="font-family: 'Courier New', courier, monaco, monospace, sans-serif; font-size: 8pt;"> <div style="font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 12pt;"> <div dir="ltr"> <hr size="1"> <font size="2" face="Arial"> <b><span style="font-weight:bold;">From:</span></b> Philipp Hamm <Philipp.Hamm@Optitool.DE><br> <b><span style="font-weight: bold;">To:</span></b> GraphHopper Java routing engine <graphhopper@openstreetmap.org> <br> <b><span style="font-weight: bold;">Sent:</span></b> Friday, March 28, 2014 9:44 AM<br> <b><span style="font-weight: bold;">Subject:</span></b> Re: [GraphHopper] ExtendedStorage for OSM
ids<br> </font> </div> <div class="y_msg_container"><br><div id="yiv7932405542"><style>#yiv7932405542 #yiv7932405542 --
_filtered #yiv7932405542 {panose-1:2 4 5 3 5 4 6 3 2 4;}
_filtered #yiv7932405542 {font-family:Calibri;panose-1:2 15 5 2 2 2 4 3 2 4;}
_filtered #yiv7932405542 {font-family:Tahoma;panose-1:2 11 6 4 3 5 4 4 2 4;}
#yiv7932405542
#yiv7932405542 p.yiv7932405542MsoNormal, #yiv7932405542 li.yiv7932405542MsoNormal, #yiv7932405542 div.yiv7932405542MsoNormal
{margin:0cm;margin-bottom:.0001pt;font-size:12.0pt;}
#yiv7932405542 a:link, #yiv7932405542 span.yiv7932405542MsoHyperlink
{color:blue;text-decoration:underline;}
#yiv7932405542 a:visited, #yiv7932405542 span.yiv7932405542MsoHyperlinkFollowed
{color:purple;text-decoration:underline;}
#yiv7932405542 span.yiv7932405542E-MailFormatvorlage17
{color:#1F497D;}
#yiv7932405542 .yiv7932405542MsoChpDefault
{}
_filtered #yiv7932405542 {margin:70.85pt 70.85pt 2.0cm 70.85pt;}
#yiv7932405542 div.yiv7932405542WordSection1
{}
#yiv7932405542 </style><div><div class="yiv7932405542WordSection1"><div class="yiv7932405542MsoNormal"><span style="font-size:11.0pt;">Hi,<br clear="none">integer is still big enough for way ids (which are currently < 270.000.000) and so int should suffice for a very long time. <br clear="none">however if you need node ids too, one field is too small.<br clear="none"><br clear="none">regards,<br clear="none">Philipp</span></div><div class="yiv7932405542MsoNormal"><span style="font-size:11.0pt;"> </span></div><div class="yiv7932405542yqt0077719746" id="yiv7932405542yqt21085"><div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm;"><div class="yiv7932405542MsoNormal"><b><span style="font-size:10.0pt;">Von:</span></b><span style="font-size:10.0pt;"> Karl Hübner [mailto:evilhack@gmx.de] <br clear="none"><b>Gesendet:</b> Donnerstag, 27. März 2014 22:50<br clear="none"><b>An:</b> Bruno Carle; GraphHopper Java routing
engine<br clear="none"><b>Betreff:</b> Re: [GraphHopper] ExtendedStorage for OSM ids</span></div></div><div class="yiv7932405542MsoNormal"> </div><div class="yiv7932405542MsoNormal" style="margin-bottom:12.0pt;">Hey Bruno, <br clear="none">the extended storage is a quite new feature, so I think you have to implement it by yourself. Since osmIds are of type long but the additional fields for edges and nodes are of type int, you have to use additional storages and let the additional fields point at its entries. I think Peter can tell you where you can find helper methods in order to split a long value into two integer values. But you're right, looking at my code in TurnCostStorage should help you. Fell free to ask if you have further questions.<br clear="none">Best regards, Karl. <br clear="none"><br clear="none">Bruno Carle <<a rel="nofollow" shape="rect" ymailto="mailto:brunocarle@yahoo.com" target="_blank"
href="mailto:brunocarle@yahoo.com">brunocarle@yahoo.com</a>> schrieb:</div><div><div><div class="yiv7932405542MsoNormal" style="background:white;"><span style="font-size:8.0pt;">Hi everybody,</span></div></div><div><div class="yiv7932405542MsoNormal" style="background:white;"><span style="font-size:8.0pt;">I would like to retrieve the osmIds from edges and/or nodes in order to be able to blacklist some paths. </span></div></div><div><div class="yiv7932405542MsoNormal" style="background:white;"><span style="font-size:8.0pt;">The blacklist will change often, so I can not put it inside a FlagEncoder as I would have to reimport every time.</span></div></div><div><div class="yiv7932405542MsoNormal" style="background:white;"><span style="font-size:8.0pt;">I think another way is using an ExtendedStorage that would store the OSM ids. Please does anyone have one running?</span></div></div><div><div class="yiv7932405542MsoNormal"
style="background:white;"><span style="font-size:8.0pt;">If not I will try to implement it, probably copying the ideas from the TurnCostStorage in khuebner/graphhopper.</span></div></div><div><div class="yiv7932405542MsoNormal" style="background:white;"><span style="font-size:8.0pt;">Thanks</span></div></div><div><div class="yiv7932405542MsoNormal" style="background:white;"><span style="font-size:8.0pt;">Bruno</span></div></div></div></div></div></div></div><br><div class="yqt0077719746" id="yqt93794">_______________________________________________<br clear="none">GraphHopper mailing list<br clear="none"><a shape="rect" ymailto="mailto:GraphHopper@openstreetmap.org" href="mailto:GraphHopper@openstreetmap.org">GraphHopper@openstreetmap.org</a><br clear="none"><a shape="rect" href="https://lists.openstreetmap.org/listinfo/graphhopper" target="_blank">https://lists.openstreetmap.org/listinfo/graphhopper</a><br clear="none"></div><br><br></div> </div>
</div> </div></body></html>