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

Routing information update as you move #376

Open
nolispe280 opened this issue Oct 20, 2017 · 15 comments
Open

Routing information update as you move #376

nolispe280 opened this issue Oct 20, 2017 · 15 comments

Comments

@nolispe280
Copy link

Description

I use the routing function in the SDK to get turn-by-turn information. By printing leg.maneuvers, I get all the maneuvers of the route ("turn right in 100m", "turn left in 50m") at once but no information on the coordinates from which I should consider them.
Is there a way of comparing your GPS location with the intersection coordinate so that you know you should use the right maneuver instruction?
Any help on this issue is welcome!

@msmollin
Copy link
Member

Unfortunately that functionality is not currently available in the iOS SDK. However we are actively working on it and it should be ready later this quarter. It is possible to do manually however, and not super involved. Basically you would need to setup Core Location and receive location updates, and pass them into a routing engine that would then need a number of milestone checks.

We do have this functionality in Android currently, so you can base your system's logic off of that if you decide you want to go at this yourself. Take a look here https://github.com/mapzen/on-the-road_android/blob/master/library/src/main/java/com/mapzen/helpers/RouteEngine.java#L50
as that is the main entry point for when GPS changes occur.

@nolispe280
Copy link
Author

Thank you Matt. I already have the location updates but the routing engine in the Mapzen-ios-sdk does not seem to have any function similar to the ones for Android (I don't fully understand what you mean by milestone checks). FYI, it seems to be possible to access "intersection coordinates" in the iOS sdk by using route.legs[0].coordinates but there is way too many points.

@msmollin
Copy link
Member

msmollin commented Oct 23, 2017

That's correct. Per my above response: Unfortunately that functionality is not currently available in the iOS SDK. However we are actively working on it and it should be ready later this quarter. It is possible to do manually however, and not super involved.

@msmollin
Copy link
Member

Milestone checks is one of the things you would need to implement. The Android implementation has examples of that (2 miles away, 1 mile away, etc.)

@msmollin
Copy link
Member

The coordinates array is the raw lat/long coordinate pairs we use to draw the shape of the route on the map. The intersections are in there merely because they are part of the route polyline. Is there something in particular you are looking for intersection-wise?

@nolispe280
Copy link
Author

Right, I already have implemented the milestone checks in my code but what is missing is the function that get the distance to the next instruction. To be more precise, only the coordinate of the intersection that corresponds to the next instruction is needed (I also already implemented a function that compute the distance to the next intersection).
Intersection-wise, I am interested in the intersection that corresponds to the instructions. (leg.maneuvers does not, unfortunately, have coordinates attached to the instructions)

@nolispe280
Copy link
Author

Let me know if you need more explanation on the issue ;)

@msmollin
Copy link
Member

msmollin commented Nov 1, 2017

Not to sound repetitive, but you should take a look at the Android code if you want to replicate that kind of functionality now. We're actively working on adding it to iOS but it won't be until later this quarter.

@nolispe280
Copy link
Author

I understood what you wrote and I did look at the Android code. Unfortunately, the function that I need is the function getDistanceToNextInstruction() which is not detailed in the java script. I would love to

do manually

as you said but it seems like it is impossible at the moment without the coordinates of the intersections coresponding to the instructions.

@msmollin
Copy link
Member

Finally getting back around to this (sorry about that). I'm not sure I'm fully understanding the issue. You receive back from Valhalla a list of maneuvers and voice instructions for those maneuvers. Each maneuver will correspond (roughly) to an intersection of a road. Is this not what you're looking for?

@nolispe280
Copy link
Author

I don't understand what is so difficult about my inquiry (which I kind of fixed but it is not perfect).
Simply put: there is no coordinates from which to start each maneuver on the list.

@nolispe280
Copy link
Author

For 3 maneuvers (turn left, turn right, turn left), I would expect 3 coordinates.

@msmollin
Copy link
Member

Ah, ok this is slightly different than the original request. That's why I was clarifying.

You are correct in that we don't expose raw GPS lat/longs directly in the legs.maneuvers object. This is likely an oversight on our part although honestly it hasn't been asked for until now. I will make sure it gets added as part of the ongoing work on it.

Thanks for taking the time to explain it.

@msmollin
Copy link
Member

In the mean time, if you wanted to attempt to do it yourself, you could manually connect to Mapzen's turn by turn servers, retrieve the response, and then parse it using the available objects in our On The Road library. Once you get to the point you have the leg manuevers, you can use the beginShapeIndex (https://github.com/mapzen/on-the-road_ios/blob/master/OTRRouting/OTRRoutingResultManeuver.h#L115) from the manuever that is available to query the shape that got returned from the service for the GPS coordinate of the start of the manuever.

@nolispe280
Copy link
Author

That has always been my one and only request ;) Thank you for taking the time to reply anyway. I already do have a way of doing it now manually but looking forward to seeing the option added to the ongoing work!

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