MapQuest.js

L.mapquest.directions().routeShape(options, callback)

A class that acts as an interface to the MapQuest Route Shape API. The results of the API call will be passed in the error-first callback style. Note that session ID's expire after 30 minutes.

Syntax

L.mapquest.key = 'KEY';

var directions = L.mapquest.directions();
directions.routeShape({
  'sessionId': 'SESSION_ID',
  'fullShape': true
}, routeShapeCallback);

function routeShapeCallback(error, response) {
  console.log(response);
}

Response

{
  "route": {
    "boundingBox": {
      "ul": {
        "lng": -77.793266,
        "lat": 40.798587
      },
      "lr": {
        "lng": -76.729667,
        "lat": 40.203571
      }
    },
    "shape": {
      "maneuverIndexes": [
        0,
        2,
        4,
        6,
        8,
        10,
        12,
        14,
        16,
        18,
        20,
        22,
        52,
        54,
        55
      ],
      "shapePoints": [
        40.203735,
        -76.729667,
        40.203617,
        -76.729705,
        40.203617,
        -76.729705,
        40.203571,
        -76.733085,
        40.203571,
        -76.733085,
        40.212993,
        -76.735542,
        40.212993,
        -76.735542,
        40.222515,
        -76.753242,
        40.222515,
        -76.753242,
        40.222,
        -76.754974,
        40.222,
        -76.754974,
        40.227867,
        -76.757873,
        40.227867,
        -76.757873,
        40.227539,
        -76.761886,
        40.227539,
        -76.761886,
        40.221908,
        -76.783859,
        40.221908,
        -76.783859,
        40.249027,
        -76.812561,
        40.249027,
        -76.812561,
        40.304954,
        -76.83039,
        40.304954,
        -76.83039,
        40.301498,
        -76.872665,
        40.301498,
        -76.872665,
        40.364498,
        -76.92881,
        40.368495,
        -76.981414,
        40.382682,
        -77.016967,
        40.397239,
        -77.008132,
        40.430889,
        -77.010658,
        40.471801,
        -77.032135,
        40.480957,
        -77.049224,
        40.479011,
        -77.068656,
        40.493789,
        -77.082611,
        40.498321,
        -77.126365,
        40.526847,
        -77.134216,
        40.564601,
        -77.169754,
        40.57061,
        -77.243759,
        40.539234,
        -77.341888,
        40.556442,
        -77.362098,
        40.594371,
        -77.377586,
        40.611503,
        -77.445732,
        40.579284,
        -77.551391,
        40.622348,
        -77.580848,
        40.653442,
        -77.583488,
        40.668922,
        -77.604171,
        40.683479,
        -77.607658,
        40.703529,
        -77.597267,
        40.727935,
        -77.604621,
        40.732955,
        -77.63565,
        40.760101,
        -77.614212,
        40.794662,
        -77.625228,
        40.798587,
        -77.656425,
        40.779037,
        -77.771057,
        40.779037,
        -77.771057,
        40.778633,
        -77.793205,
        40.778633,
        -77.793205,
        40.777702,
        -77.793266
      ],
      "legIndexes": [
        0,
        56
      ]
    },
    "routeError": {
      "message": "",
      "errorCode": -400
    },
    "options": {
      "mustAvoidLinkIds": [],
      "drivingStyle": 2,
      "countryBoundaryDisplay": true,
      "generalize": -1,
      "narrativeType": "text",
      "locale": "en_US",
      "avoidTimedConditions": false,
      "destinationManeuverDisplay": true,
      "enhancedNarrative": false,
      "filterZoneFactor": -1,
      "timeType": 0,
      "maxWalkingDistance": -1,
      "routeType": "FASTEST",
      "transferPenalty": -1,
      "stateBoundaryDisplay": true,
      "walkingSpeed": -1,
      "maxLinkId": 0,
      "arteryWeights": [],
      "tryAvoidLinkIds": [],
      "unit": "M",
      "routeNumber": 0,
      "shapeFormat": "raw",
      "maneuverPenalty": -1,
      "useTraffic": false,
      "returnLinkDirections": false,
      "avoidTripIds": [],
      "manmaps": "true",
      "highwayEfficiency": 22,
      "sideOfStreetDisplay": true,
      "cyclingRoadFactor": 1,
      "urbanAvoidFactor": -1
    }
  },
  "info": {
    "copyright": {
      "text": "© 2017 MapQuest, Inc.",
      "imageUrl": "http://api.mqcdn.com/res/mqlogo.gif",
      "imageAltText": "© 2017 MapQuest, Inc."
    },
    "statuscode": 0,
    "messages": []
  }
}