0

I am making an application that generates routes based on atypical heuristics so I would like a service much like Mapbox Directions API but I could:

  1. Disable the internal routing. (i.e. if I give a path A -> B -> C I don't want the api to change my route to the shortest/fastest path of A -> C much less waste the resources to do so).
  2. Since i'll be inserting the entire route I would need the capability of inputting a virtually limitless number of points instead of the 2 - 26 that are offered by most directions apis.

Essentially I am looking for a turn-by-turn instruction generator that is decoupled from the routing portion of the library.

The closest thing I can find would be to set up my own OSRM backend as that would allow me to achieve my second goal of unlimited waypoints but still runs its own routing and is too much hassle to set up and maintain.

Does anyone have any ideas of a library that may achieve what I'm looking for?

My question is similar to some existing questions like Seeking route calculation service to get route between several points? but the main difference being I do not want any routing so please don't refer me to libraries that have the routing portion like OSRM.

For example, I have a list of coords that represent the exact route that I have calculated. I give the api these coords.

        "coordinates": [
      [
        -87.62252748012543,
        41.88330112135344
      ],
      [
        -87.62416362762451,
        41.88329313366847
      ],
      [
        -87.62420117855072,
        41.880840867169994
      ],
      [
        -87.6208108663559,
        41.88088480111109
      ],
      [
        -87.62087523937225,
        41.881004620796936
      ],
      [
        -87.62073040008545,
        41.88429558033205
      ],
      [
        -87.62248456478119,
        41.884275611428535
      ],
      [
        -87.62250602245331,
        41.883297127511085
      ]
    ]

And the api would return directions without changing the route.

       "steps": [
        {
          "points": [
            {
              "location": [
                87.426579,
                41.508068
              ]
            },
            {
              "location": [
                -87.6206579,
                 41.88308068
              ]
          ],
          "geometry": "mnn_Ick}pAHUlAqDNa@",
          "mode": "walking",
          "duration": 18.6,
          "maneuver": {
            "bearing_after": 125,
            "type": "depart",
            "modifier": "right",
            "bearing_before": 0,
            "location": [
              -87.6206579,
              41.88308068
            ],
            "instruction": "Head southeast on Köpenicker Straße (L 1066)"
          },
          "ref": "L 1066",
          "weight": 18.6,
          "distance": 98.1,
          "name": "The Bean"
        },
        {
        .....
    }
  ],
  • 1
    Please elaborate what and why you expect here exactly. Maybe with some drawing or data sample. You ask ’routing without routing’, which is atypical indeed. – JaakL Nov 14 '17 at 5:40
  • This doesn't answer the question how you want, but ArcGIS.com routing allows for 150 stops (waypoints) with a Sync service, and up to 10,000 when using the Async service. This service does require you to be authenticated with arcgis.com, but depending on your application/business, you might be able to do this at no cost (ie. developer account) – KHibma Nov 23 '17 at 17:22
  • I'm not totally sure if I understand your question correctly (even after looking at your sample data): Do you always assume there is a simple straight route between your given points, which means turning is only possible at one of the waypoints? In this case you can probably try also to compare the coordinates and get the approximate direction based on this comparison. Besides that, did you think about splitting up your request into the max number of waypoints your chosen API supports and then combine the responses in your application? – tallistroan Nov 23 '17 at 17:52
  • My apologies, I think there is some subtle terminoligy I am missing. When I give the points I assumed they're fixed. I want to provide the exact route down to each OSM node being used and I won't vary from that route. I think the solution provided by OSRM has taken care of the primary issue of translating between directions to instructions which I failed initially to articulate in this question. Thank you all for your help! – Brian Olsen Nov 23 '17 at 18:00
1

So it turns out my terminology was misleading when I was initially searched for this library and asked this question. I was unaware that there's a subtle distinction between the term instruction and direction. Direction seems to refer to the result of a routing procedure while instruction seems to refer to the translation of each segment of the resulting directions to a human readable format based on a given locale.

Luckily, once I learned about this subtle distinction I searched route instruction library and it turns out OSRM has already provided this library in javascript, java, and swift/objective-c.

There are still some pieces missing like I will still need to break my list of points into segments and call a geocoding service like mapbox to get the street names to generate the OSRM route step object. I think this part is much simpler to deal with and will update this answer with solutions as I find them.

It turns out that the java version of the osrm text instruction library hasn't been maintained for a few months so I ported my own java version of the text instructions library. That is half the battle. Will post when my other library is finished that will use this library.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.