0

I'm trying to block edges in my graphhopper routing, following the example described in the docs (https://github.com/graphhopper/graphhopper/blob/master/docs/core/weighting.md). I try to find the edges which have to get blocked with

EdgeIteratorState edge = hopper.getLocationIndex().findClosest(lat, lon, EdgeFilter.ALL_EDGES ).getClosestEdge();

But when running my App, it shows up that some completely different edges are blocked, not the ones I tried to block. What am I doing wrong, do you have any hints? I got stuck with this problem since four days now, no ideas left.

  • Without any further information it is hard to guess. Is lat,lon in the correct order? Is getClosestEdge.getEdge actually some positive value? Is the blocking weighting correctly picked and contains actually the found edge Ids? – Karussell May 04 '15 at 10:16
  • There is a similar example. Maybe you try this before? https://github.com/karussell/graphhopper-traffic-data-integration/ – Karussell May 04 '15 at 10:17
  • thanks for the quick reply! Yes, lat/long is in the correct order. To be a bit more specific: while debugging through the calcWeight-Method of my BlockingWeighting class, it is giving me following edges for the calculated path: 28 [22->1, 22->16], 30 [22->1. 22->16], 20 20 13-6, 19 19 6-5, 12 [1-22, 17 1-20, 12 1-2], and the forbiddenEdges are 0,9 and 10. Please have a look at the ![attached picture](http://www.c-it.at/Screenshot_2015-05-05-08-32-47.jpg). - the calculated route is drawn in blue. I am using an offline map for indoor routing - maybe I did something wrong creating the map? – Monika Hoedl May 05 '15 at 07:03
  • Did you disable the speed mode? graphhopper.setCHEnabled(false) – Karussell May 05 '15 at 07:11
  • I tried it before, but if I do, I get this error: java.lang.IllegalStateException: Cannot load the graph when using instance of com.graphhopper.storage.GraphHopperStorage and location: /data/data/cc.bitmedia.app.secureflex/cache/KS337_2/ – Monika Hoedl May 05 '15 at 07:28
  • maybe I am doing something wrong while generating the graph info with graphhopper.sh? I use 'graph.flagEncoders=foot', and before loading the graph I set tmpHopp.setEncodingManager(new EncodingManager("FOOT")); is there any other setting I miss? – Monika Hoedl May 05 '15 at 08:05

1 Answers1

0

Don't know yet, if this is elegant, but I think I found a workaround: in the config.properties of the graphhopper.sh I added

prepare.chWeighting=no

and while loading the graph, I set

tmpHopp.setCHEnable(false);

To block an edge afterwards, I simply set the speed for this edge to 0

FlagEncoder footEncoder =    TempAppData.getInstance().getHopper().getEncodingManager().getEncoder("foot");
                edge.setFlags(footEncoder.setSpeed(edge.getFlags(), 0));
  • 1
    Setting the speed to 0 is not recommended. Instead use the access properties. footEncoder.setAccess. Also if you create the hopper in your application there is no need to change the configuration AND with the java API, just one is good. I've also updated the weighting docs to avoid this misunderstanding regarding chWeighting in the future. – Karussell May 05 '15 at 10:35