Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The reason you are getting an error is because your start point is in the middle of the <a href="https://en.wikipedia.org/wiki/Rub%27_al_Khali" rel="nofollow">Empty Quarter</a> of Saudi Arabia, where there are literally no roads for miles around. The routing api tries but fails to find a <strong>nearby</strong> road to start the route from an sends back an error response.</p> <p>The <a href="http://developer.here.com/javascript-apis/documentation/maps" rel="nofollow">JavaScript API</a> is simply a wrapper around the underlying RESTful <a href="http://developer.here.com/rest-apis/documentation/routing" rel="nofollow">Routing API</a>. If you look at the underlying <a href="http://route.cit.api.here.com/routing/7.2/calculateroute.json?waypoint0=20,54&amp;waypoint1=0.06275,0.3966&amp;mode=fastest;car;traffic%3aenabled&amp;app_id=DemoAppId01082013GAL&amp;app_code=AJKnXv84fjrb0KIHawS0Tg" rel="nofollow">response</a> you will get the following error:</p> <pre><code>{ "type":"ApplicationError", "subtype":"NoRouteFound", "details":"Error is NGEO_ERROR_ROUTE_NO_START_POINT", "additionalData":[ { "key":"error_code", "value":"NGEO_ERROR_ROUTE_NO_START_POINT" } ], "metaInfo": { "timestamp":"2013-12-16T11:14:22.991", "mapVersion":"8.30.52.113", "moduleVersion":"7.2.39.0_CD-793_1", "interfaceVersion":"2.4.37" } } </code></pre> <p>This is handled in the JavaScript Wrapper by setting the <code>state</code> of the Routing Manager to <code>"failed"</code></p> <p>Presumably you already have an observer for the <code>state</code> attribute in your code, you can extend it to handle the error case as shown:</p> <pre><code>onRouteCalculated = function (observedRouter, key, value) { if (value == "finished") { var routes = observedRouter.getRoutes(); var mapRoute = new nokia.maps.routing.component.RouteResultSet(routes[0]).container; map.objects.add(mapRoute); map.zoomTo(mapRoute.getBoundingBox(), false, "default"); } else if (value == "failed") { alert("The routing request failed."); } }; </code></pre> <p>The code for a fully working <a href="http://developer.here.com/apiexplorer/examples/api-for-js/routing/map-with-route-from-a-to-b.html" rel="nofollow">example</a> with error handling can be found within the <a href="http://developer.here.com/javascript-apis/api-explorer" rel="nofollow">API Explorer</a> </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. COWell that's what I was saying. I was expecting the routing request to fail, but I never receive that expected (and quite normal) failure state because an actual failure in the code is crashing the javascript. Compare the expected response that you posted with what I actually received while debugging. Your type, subtype, details, and additionalData fields all have values. I posted the response that I got which is missing any values for 'additionalData'. And so it crashes. It looks to me like I'm getting incomplete response data.
      singulars
    2. COThe request generated from my code looks like this https://route.nlp.nokia.com/routing/6.2/calculateroute.json?routeattributes=shape&maneuverattributes=direction,shape&jsonAttributes=1&waypoint0=geo!25,54&waypoint1=geo!0.06275,0.3966&language=en-US&mode0=shortest;car;&app_id=WgevZ2m4AF8WHx1TY6GS&app_code=G11AO2dbvCRTdCjfTf-mUw&xnlp=CL_JSMv2.5.3,SID_1E571B54-B7F4-45B2-A6B6-60CB22A07C6C&jsoncallback=(function()%7Bnokia.maps.net.Request.callbacks%5B4%5D(5,arguments);%7D) As you can see there are no values in additionalData.
      singulars
    3. COThe different response depends upon whether you are using Enterprise Routing 6.2 or Standard Routing 7.2 I plugged in your location into the [example](http://developer.here.com/apiexplorer/examples/api-for-js/routing/map-with-route-from-a-to-b.html) and it failed gracefully for me. How does that example work for you?
      singulars
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload