Error "Connection not found"

Hi guys,

Really not sure if the topic is correct. Apologies if not.

I have added a traffic tag in my osm docs and I also have modified some java lines to be able to read the added traffic tag. When I do such, I some times get an connection not found error for some points.

Would anybody have a clue why?

I suspect that the fastest-car option is for something in this, but I would be grateful for any confirmation.

Many thanks in advance.

Hard to say without the code, but probably you either slow down or block some roads. GraphHopper then cannot find a connection between your start and end anymore.

Hey, many thanks for your quick reply.

Not sure how much I should be posting. So here is some code. The names should be self explanatory. The idea is that for the nodes in my osm, I have a traffic value. When parsing ways, I look at the value of consecutive nodes, I take the average value. I compute an effective distance and calculate a beta coefficient from there. If ever a node was encountered with a blocked road I indicate the way as having a beta coef (hence a velocity) of zero.


private final Map<Long, Double> traffic_map = new HashMap<Long, Double>();
if (osmNodeIds.get(0) != osmNodeIds.get(osmNodeIds.size() - 1)) {
for (int i = 0; i < osmNodeIds.size(); i ++) {
if (i < osmNodeIds.size() - 1) {
lat_i = getTmpLatitude(getNodeMap().get(osmNodeIds.get(i)));
lon_i = getTmpLongitude(getNodeMap().get(osmNodeIds.get(i)));
lat_i_plus_one = getTmpLatitude(getNodeMap().get(osmNodeIds.get(i + 1)));
lon_i_plus_one = getTmpLongitude(getNodeMap().get(osmNodeIds.get(i + 1)));
average_traffic = .5*(traffic_map.get(osmNodeIds.get(i)) + traffic_map.get(osmNodeIds.get(i + 1)));
alpha_i = average_traffic/traffic_max;
if (alpha_i == 1.) has_blocked_node = true;

			    distance_i = distCalc.calcDist(lat_i, lon_i, lat_i_plus_one, lon_i_plus_one);
			    distance += distance_i;
			    effective_distance += distance_i/Math.max(0.0001, (1. - alpha_i));
             if (has_blocked_node) beta = 0.;
	 else beta = distance/effective_distance;

            way.setTag("distance", String.valueOf(distance));
            way.setTag("effective_distance", String.valueOf(effective_distance))
            way.setTag("beta", String.valueOf(beta));

Velocity of the way is modified in the file. See below.

Double beta = Double.parseDouble(way.getTag(“beta”));
speed = speed*beta;


Really sorry, that was my third post ever. Looks like I sent a bit of a messy message… Info is right though.

btw: you can still edit to format your code using the ‘preformatted text’ or start and finish with:

As you mentioned it is pretty hard to read :). I think I would try to debug the code. I would assume that you end up calculating an incorrect velocity, so edges end up with speed=0.

I would probably try to look at the beta value in the CarFalgEncoder, I would assume that you will see a lot of very small values for beta:

Double beta = Double.parseDouble(way.getTag("beta"));


speed = speed*beta;

Lol, I know… Sorry!

I will look into it. I guess You are right but I just could not figure where in the framework there is an edge selection based on velocity. Because in any case, we do need to have varying velocities to take into account trafic!