Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Navigation directions missing distance, Any other method that returns distance with directions? #319

Open
YogeshwarBodapatla opened this issue Jul 16, 2020 · 4 comments

Comments

@YogeshwarBodapatla
Copy link

Sorry if the title is too vague .

I am trying to create a List of instructions for a point A to point B.
I am using

var instr = route1.GenerateInstructions(routerDb);

In this i get a list of verbal routes , Like go straight , take left .

But what I am looking for is - go straight <10 km> , take left , continue <1 km> etc .

I went through the documentation but was not able to find any method that returns distance corresponding to the particular Navigation instruction. Can you please help me figure this out , if Itinero supports it?

@juliusfriedman
Copy link

Doesn't the stops in the meta contain the distance from the previous?

@YogeshwarBodapatla
Copy link
Author

Thanks for the reply . No , in my case i see like 8 instructions , but only two stops(in Route Object) . These two stops are Origin and Destination with distanes 0.0 and Full distance.

@juliusfriedman
Copy link

juliusfriedman commented Jul 19, 2020

Thanks for the reply . No , in my case i see like 8 instructions , but only two stops(in Route Object) . These two stops are Origin and Destination with distanes 0.0 and Full distance.

Can you post a link to your pbf and some sample code (or a link to a gist with such sample code) which demonstrates your problem please?

Thank you!

See also: #302

@YogeshwarBodapatla
Copy link
Author

The PBF that i am using is this (GCC States) : https://download.geofabrik.de/asia/gcc-states.html

RouterDb routerDb = null;
using (var stream = new FileInfo(@"GCCStatesRoute.routerdb").OpenRead())
{
routerDb = RouterDb.Deserialize(stream);
}
var router = new Router(routerDb);

        // get a profile.
        var profile = Vehicle.Car.Fastest();
        double[] source =new[] { 24.6595, 46.7674 };
        double[] dest = new[] { 24.6380, 46.8217 };
        var start = router.Resolve(profile,(float)source[0], (float)source[1],250);//24.694034f, 46.629505f);
        var end = router.Resolve(profile, (float)dest[0],(float)dest[1],250);

        Route route1 = router.Calculate(profile, start, end);
        var instr = route1.GenerateInstructions(routerDb);

Here "instr" has list of instructions , i want to get the distance associated with the instructions . "route1" has shapemeta and stops but they dont match with Instructions . Is there any other method for generating instructions ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants