GraphHopper.com | Forum | GitHub | Maps | Blog

Directions does not consider heading (sometimes)


#1

Hi everyone,

I am using (and modifying) the library ffwdme.js for gps-like navigation and I have an issue where when I go off route and I make a brand new request to go to my end goal, i very often get issues where I am driving in a straight line and the route it gets calculated is basically behind me, as if the heading is not in the equation at all. Obviously this is very bad form a user perspective because I cannot simply “turn around”.

I made a little sktech to explain it futher -->

Anyone have a solution that would help me fix this issue?

Thanks in advance.


#2

Which request is fired under the hood - one with ch.disable=true? Or do you have a GraphHopper Maps link for this case?


#3

Hi Karussell,
The request has the following params:

type:jsonp
key: - - - - – — - - - - – -
locale:en
vehicle:truck
weighting:fastest
point:55.677045,12.583500000000015
point:55.682141,12.588744999999989
ch.disable:true
heading:NaN
heading:360
pass_through:true
callback:ffwdme.utils.Proxy.callbacks.cb4

Let me know.


#4

It looks like a different case. And the end point in your recent is on a one way so it cannot arrive from a different side. If you meant you start at this point and use the heading for the other point then this works as you can see for those two requests


#5

Hi there.

The request i posted had different start location. I only copied that request even though it was a different starting point only because the rest is the same. However, you inverted start and end point.

The starting point should have been 55.676194, 12.586909 and end point: 55.682141,12.588745

Regardless of it, I changed the data in your two links and still, the same problem occurs. even though im pointing south and heading south, it just suggests me to “simply” go straight back as if it didn’t know where I was headed.


#6

I still do not understand the problem. Would you post the link regarding your description?


#7

Here:

With Heading

Without Heading

This is what the street looks like (With a little description): Pic

In a nutshell the problem can be described as that when you route (in my case is a re-route but the fundamental basic request is simply a call to the directions api) from a to b if you are on a straight road and headed towards the opposite destination of your target (for some reason) you will get directions as if you were driving correctly because you are “still” on the right road but it doesn’t know you are on the right lane headed to the opposite side as opposed to the left lane actually going towards the goal.


#8

Either I still do not understand the problem or there are two mistakes for the first link:

  1. the heading is north based ie. it should be 180 (Headings are given as north based clockwise angle between 0 and 360 degree.) and
  2. the heading should be the first parameter if it should be related to the first point. See here for the corrected link

#9

That’s exactly what i needed! thanks!

It was the first heading that had to be set!