1

I was wondering if there is a way to get the highway direction of the route.

To be more specific, I am interested in routes on interstate highways in the United States only.

I'll give an example:

Interstate I45 is a north-south highway. When the route is returned, is there a way to know which "direction lane" the route is on?

The problem I'm trying to solve is accessing the rest ares like the one shown on the image here. As you can see, these are two rest areas, each accessible from one direction of the highway.

I would like to display only those accessible from the direction the user is on. I have all the data needed, including if the rest area is on the North/South/East/West direction and I only need the highway direction the route is on.

For obvious reasons, I would like to avoid manually checking if the route just appears to be going northwards.

I checked if this is possible via graphhopper, but it only gives the highway name, without direction. Is it possible to achieve this via Skobbler?

Igor
  • 329
  • 1
  • 3
  • 10

3 Answers3

1

If you are using the TTS instructions (text-to-speech) then in the advice instructions & audio advices you will also receive the "orientation" (coded as a $orientation in the audio config files) - indicating the direction you are driving on a particular highway (south/north, etc.).

The trickier part is that you would have to parse the text instruction to get this information as it's not returned in a separate field (let me know in a comment if this was helpful).

Ando
  • 11,199
  • 2
  • 30
  • 46
  • This sounds like it might be what I'm looking for. Parsing the text wouldn't be an issue. However, I'm having trouble finding where is all that used - all I can find is specifying whether the internal tts is used, or the list of files: http://developer.skobbler.com/getting-started/android#sec017 – Igor Aug 03 '15 at 08:38
  • You get those advices either when you request the advice list for the route or during navigation, you get callbacks with the text to be played – Ando Aug 03 '15 at 09:36
  • As I can see it's in android/ios api only. Since this information will have to end up on our java-based backend, is it possible to use android library directly on the backend (for getting route and audio advices only), or it would have to be somehow relayed from the mobile device? – Igor Aug 06 '15 at 10:08
1

I do not fully understand the original problem but as GraphHopper also returns the geometry for every instruction you should be able to calculate the orientation roughly but easily.

Another more complex approach would be to have a predefined name set associated with the geometry and use the map matching component to find out which highway parts are used in a route.

For obvious reasons,

which obvious reasons? That it is not really going norht south?

Or if something is not possible you always can modify in the code as it is open source or provide a pull request to merge it into the public release (if useful for others) and make it available for the Directions API too.

Karussell
  • 17,085
  • 16
  • 97
  • 197
  • Reason against manually determining if the route is going e.g. south and then using this information as a basis for selecting the direction of the highway is for cases like this: 46.270605, -112.226890. It's a north-south highway, but, if taking just this part of the highway for analysis, it would be impossible to determine which highway direction the user is headed to. – Igor Aug 03 '15 at 08:21
  • Ok. I would then pre-process the *full highway* and mark all parts appropriated. And while map matching you can easily retrieve these info for every part – Karussell Aug 04 '15 at 19:10
0

According to the OSM wiki page Highway Directions In The United States, directions of ways are supposed to be modeled as relation membership roles.

For example, I 75 way 173483918 is a member of the relation 332618 named "I 75 (TN northbound)" with role=north, so it's direction is "north".

The opposite way 173483897 is a member of the relation 332624 named "I 75 (TN southbound)" as role "south".

See more details on the wiki page. Don't know how well established that tagging scheme is, also don't know about router support (Telenav (Scout) seem to be involved in this who now own Skobbler).

  • The highway orientation is implicitly contained in the geometry and tags, there is no need for a relation. – scai Aug 02 '15 at 09:49