[GraphHopper] ExtendedStorage for OSM ids

Doanh Tran dangdoanh.sp at gmail.com
Wed Apr 2 07:43:36 UTC 2014


Hi Everybody,
I downloaded routing data for VietNam map, But it's not working.
Can you help me to resolve the issues related to routing data of VietNam ?

Thank ,
Doanh


2014-03-28 20:43 GMT+07:00 Bruno Carle <brunocarle at yahoo.com>:

> Thanks everybody for your comments.
>
> At the moment I would like to be able to blacklist both nodes and edges,
> so I will stick with the ExtendedStorage.
>
> I have hacked an implementation for blacklisting nodes, but there are a
> couple of things which are not clear to me.
>
> I created a class OSMReaderWithOsmIds which overrides addNode:
>
>    @Override
>    boolean addNode(OSMNode node ){
> if (super.addNode(node)){
>     int nodeId=super.getNodeMap().get(node.id);
> (A)         if (nodeId>0) {
>                ((OsmIdsExtendedStorage)getGraphStorage().
>                  getExtendedStorage()).setNodeOsmId(nodeId, node.getId());
>     }
>     return true;
> } else
>     return false;
>    }
>
>
> where OsmIdsExtendedStorage has:
>
>     public int getEntryIndex(int nodeIndex){
>     return graph.getAdditionalNodeField(nodeIndex);
>     }
>
>     public int createNewEntry(int nodeIndex){
>     // create new entry
>        int newEntryIndex = count;
>        count++;
>        ensureEntryIndex(newEntryIndex);
> (B)    graph.setAdditionalNodeField(nodeIndex, newEntryIndex);
>        return newEntryIndex;
>    }
>
>     public void setNodeOsmId(int nodeIndex,long osmId){
> int entryIdx=getEntryIndex(nodeIndex);
> if (entryIdx==NO_ENTRY){
>             int newEntryIndex =createNewEntry(nodeIndex);
>             // now populate the entry
>
> dataAccess.setBytes(newEntryIndex*entrySize,BitUtil.BIG.fromLong(osmId),entrySize);
> }
>     }
>
> 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 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)
>
> 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
>
> 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?
>
> Thanks
> Bruno
>
>
>
>
>
>   ------------------------------
>  *From:* Philipp Hamm <Philipp.Hamm at Optitool.DE>
> *To:* GraphHopper Java routing engine <graphhopper at openstreetmap.org>
> *Sent:* Friday, March 28, 2014 9:44 AM
> *Subject:* Re: [GraphHopper] ExtendedStorage for OSM ids
>
> Hi,
> integer is still big enough for way ids (which are currently <
> 270.000.000) and so int should suffice for a very long time.
> however if you need node ids too, one field is too small.
>
> regards,
> Philipp
>
> *Von:* Karl Hübner [mailto:evilhack at gmx.de]
> *Gesendet:* Donnerstag, 27. März 2014 22:50
> *An:* Bruno Carle; GraphHopper Java routing engine
> *Betreff:* Re: [GraphHopper] ExtendedStorage for OSM ids
>
> Hey Bruno,
> 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.
> Best regards, Karl.
>
> Bruno Carle <brunocarle at yahoo.com> schrieb:
> Hi everybody,
> I would like to retrieve the osmIds from edges and/or nodes in order to be
> able to blacklist some paths.
> The blacklist will change often, so I can not put it inside a FlagEncoder
> as I would have to reimport every time.
> I think another way is using an ExtendedStorage that would store the OSM
> ids. Please does anyone have one running?
> If not I will try to implement it, probably copying the ideas from the
> TurnCostStorage in khuebner/graphhopper.
> Thanks
> Bruno
>
> _______________________________________________
> GraphHopper mailing list
> GraphHopper at openstreetmap.org
> https://lists.openstreetmap.org/listinfo/graphhopper
>
>
>
> _______________________________________________
> GraphHopper mailing list
> GraphHopper at openstreetmap.org
> https://lists.openstreetmap.org/listinfo/graphhopper
>
>


-- 

Trân trọng,

Tran Dang Doanh
 M: (84) 943438338 E: dangdoanh.sp at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/graphhopper/attachments/20140402/7c51dc41/attachment.html>


More information about the GraphHopper mailing list