如何识别Here Maps的Mock JSON格式

时间:2016-07-11 18:34:41

标签: angular

如果有人知道Here Map的例子的json格式,那里有A点到B点的路由。

这是链接 https://developer.here.com/api-explorer/maps-js/v3.0/servicesRouting/map-with-truck-route-from-a-to-b

我想要传递给

的JSON格式
  var route = result.response.route[0];

如果有人知道这些信息,请告诉我。

1 个答案:

答案 0 :(得分:0)

Using the Network tab in the Chrome developer console (see this answer on using the network tab to view API requests: How can I debug a HTTP POST in Chrome?) I was able to capture the response from the API call. The object returned by result.response.route[0] is:

{
    "routeId": "REM8zjIAAAB2Tx4Wav1EQGpN845T-FXAAAAA4HL9REAAAAAgW_hVwAAAAAAAAPB_AAAAAAAA8H9VtnU3rYvbaADPEwFd_kP67etXAQMAAAD_zhMBAQAAgPHrVwEDAAAAAADA_wEAAAAAAMD_aR0pCYcHtYTjob4X2h8eiZg3uPHjvAEA",
    "waypoint": [{
        "linkId": "+930461269",
        "mappedPosition": {
            "latitude": 41.9800682,
            "longitude": -87.8805618
        },
        "originalPosition": {
            "latitude": 41.9798,
            "longitude": -87.8801
        },
        "type": "stopOver"
    }, {
        "linkId": "-1035319462",
        "mappedPosition": {
            "latitude": 41.9042892,
            "longitude": -87.9216537
        },
        "originalPosition": {
            "latitude": 41.9043,
            "longitude": -87.9216
        },
        "type": "stopOver"
    }],
    "mode": {
        "type": "fastest",
        "transportModes": ["truck"],
        "feature": []
    },
    "shape": ["41.9800682,-87.8805618", "41.9800682,-87.8805618",
        "41.9802513,-87.8803329", "41.9806786,-87.8792419",
        "41.9807701,-87.8790512", "41.9808807,-87.8787994",
        "41.9810104,-87.8785095", "41.9812508,-87.8779297",
        "41.9819412,-87.8762131", "41.9820709,-87.8759079",
        "41.98209,-87.8758621", "41.9821091,-87.8757935",
        "41.9821701,-87.8756332", "41.9823494,-87.8751907",
        "41.9823799,-87.8750992", "41.9825897,-87.8744431",
        "41.9825897,-87.8740082", "41.9825706,-87.8738174",
        "41.9825287,-87.873558", "41.9824104,-87.8731537",
        "41.9822693,-87.872818", "41.9820786,-87.8724136",
        "41.9818687,-87.8720093", "41.9816399,-87.8716278",
        "41.981369,-87.8712616", "41.9810104,-87.8708572",
        "41.98069,-87.8704987", "41.9805183,-87.8703918",
        "41.9801712,-87.8702164", "41.9798012,-87.8700867",
        "41.9790611,-87.8698273", "41.9783516,-87.8697586",
        "41.9775581,-87.8696518", "41.9765816,-87.8695068",
        "41.9758186,-87.8694077", "41.9755516,-87.8693695",
        "41.9748993,-87.8693314", "41.9743195,-87.8693695",
        "41.973999,-87.8694305", "41.9735184,-87.8695221",
        "41.9731216,-87.8696289", "41.9729195,-87.8697128",
        "41.9727707,-87.8697662", "41.9723587,-87.869957",
        "41.9717789,-87.8702621", "41.9712105,-87.8706131",
        "41.9709587,-87.8707581", "41.9699783,-87.8714676",
        "41.9697113,-87.8716278", "41.9695892,-87.8717117",
        "41.9695015,-87.8717728", "41.9692497,-87.871933",
        "41.9686394,-87.8723373", "41.9681206,-87.8726807",
        "41.9668617,-87.8735199", "41.96661,-87.8736877",
        "41.9662895,-87.8739014", "41.9656181,-87.8743362",
        "41.963089,-87.8760376", "41.9627113,-87.8762894",
        "41.9618187,-87.8768463", "41.9611588,-87.8772736",
        "41.9605103,-87.8776398", "41.9593201,-87.8783188",
        "41.9589996,-87.87854", "41.9586296,-87.8787766",
        "41.9570084,-87.8798676", "41.9566917,-87.8800888",
        "41.9564285,-87.8802414", "41.9561386,-87.8804092",
        "41.9552612,-87.8809204", "41.955101,-87.8810196",
        "41.9542389,-87.8814697", "41.953331,-87.8818588",
        "41.9486198,-87.8837585", "41.9480515,-87.8840103",
        "41.9474716,-87.8842773", "41.9472084,-87.8843994",
        "41.9466705,-87.8846817", "41.9458694,-87.8851089",
        "41.9458008,-87.8851471", "41.94561,-87.8852768",
        "41.945549,-87.8853226", "41.9454002,-87.8854065",
        "41.9450493,-87.8856735", "41.9447403,-87.8859177",
        "41.9443283,-87.8862991", "41.9439392,-87.8867111",
        "41.943409,-87.8873291", "41.9432793,-87.8874969",
        "41.9431114,-87.8877335", "41.9427986,-87.8881683",
        "41.9427185,-87.8883133", "41.9426384,-87.8884277",
        "41.9425392,-87.8886032", "41.9424019,-87.8888626",
        "41.9422989,-87.8890381", "41.9421883,-87.8892593",
        "41.94207,-87.8894882", "41.9417305,-87.8902817",
        "41.9416504,-87.89048", "41.9415703,-87.8907089",
        "41.9415207,-87.8908386", "41.9413109,-87.8914719",
        "41.9411392,-87.8920975", "41.9410706,-87.8924179",
        "41.941021,-87.892662", "41.9408607,-87.8934631",
        "41.9404106,-87.8959732", "41.9400101,-87.8981934",
        "41.9394417,-87.9013367", "41.9389191,-87.9044876",
        "41.9379311,-87.9104919", "41.9376717,-87.9119873",
        "41.9375,-87.9126968", "41.9372902,-87.9134064",
        "41.9370499,-87.9141006", "41.9369392,-87.9143677",
        "41.936821,-87.9146194", "41.936451,-87.9153824",
        "41.9361,-87.9159775", "41.9357185,-87.9165421",
        "41.9353218,-87.9170685", "41.9348984,-87.9175415",
        "41.9342117,-87.9181824", "41.9334793,-87.9187317",
        "41.9329605,-87.9190369", "41.9324303,-87.9192886",
        "41.9320488,-87.9194336", "41.9315796,-87.9195938",
        "41.9313011,-87.9196625", "41.9305305,-87.9197922",
        "41.9299583,-87.9198074", "41.9281998,-87.9198074",
        "41.9211617,-87.919838", "41.9158592,-87.9198685",
        "41.911911,-87.919899", "41.9078293,-87.9199295",
        "41.9070396,-87.9199295", "41.9068718,-87.9199295",
        "41.9068108,-87.9199295", "41.9067383,-87.9199295",
        "41.9065094,-87.9199371", "41.9059296,-87.9199371",
        "41.9055595,-87.9200974", "41.9052811,-87.9202194",
        "41.9051514,-87.9203186", "41.9050484,-87.9204636",
        "41.9049606,-87.9206314", "41.9048996,-87.9208603",
        "41.9048805,-87.9210892", "41.9048996,-87.9213104",
        "41.9049301,-87.9214935", "41.9049988,-87.921669",
        "41.9051018,-87.9218369", "41.9051819,-87.9219589",
        "41.9053001,-87.9220963", "41.9054108,-87.9222488",
        "41.9055099,-87.9224167", "41.9058304,-87.9227066",
        "41.9060097,-87.9229126", "41.9062881,-87.9232483",
        "41.9064293,-87.9234238", "41.9064713,-87.9234619",
        "41.906601,-87.9236374", "41.9067192,-87.9237823",
        "41.9070206,-87.9239502", "41.9071693,-87.9240036",
        "41.9072914,-87.9239731", "41.9074211,-87.9238892",
        "41.9075089,-87.9237823", "41.9075699,-87.9236526",
        "41.9076195,-87.9234467", "41.9076195,-87.9232178",
        "41.9075508,-87.9230118", "41.9074097,-87.9228363",
        "41.9072685,-87.9227371", "41.9070892,-87.922699",
        "41.906929,-87.9227676", "41.9067917,-87.9228973",
        "41.9067116,-87.9230804", "41.906601,-87.9236374",
        "41.906601,-87.923912", "41.9065895,-87.9241333",
        "41.9065895,-87.9249573", "41.9067001,-87.9254379",
        "41.9067802,-87.9256516", "41.9068489,-87.9257584",
        "41.906929,-87.9258499", "41.9070206,-87.9259109",
        "41.9071617,-87.9259262", "41.90728,-87.9258804",
        "41.907341,-87.9258118", "41.9073906,-87.9256363",
        "41.9073906,-87.9255295", "41.9073792,-87.9254303",
        "41.907341,-87.9253235", "41.9072113,-87.9250793",
        "41.9065895,-87.9241333", "41.9064484,-87.9239426",
        "41.9063797,-87.9238434", "41.9060402,-87.9233932",
        "41.905159,-87.9223328", "41.9050102,-87.9222031",
        "41.9047394,-87.9219666", "41.9042892,-87.9216537"
    ],
    "leg": [{
        "maneuver": [{
            "direction": "forward",
            "action": "continue",
            "position": {
                "latitude": 41.9800682,
                "longitude": -87.8805618
            },
            "instruction": "Take ramp onto <span class=\"street\">I-190 E</span>. <span class=\"distance-description\">Go for <span class=\"length\">0.4 miles</span>.</span>",
            "placeEquipment": [],
            "travelTime": 29.1,
            "length": 574.0,
            "shape": ["41.9800682,-87.8805618",
                "41.9800682,-87.8805618",
                "41.9802513,-87.8803329",
                "41.9806786,-87.8792419",
                "41.9807701,-87.8790512",
                "41.9808807,-87.8787994",
                "41.9810104,-87.8785095",
                "41.9812508,-87.8779297",
                "41.9819412,-87.8762131",
                "41.9820709,-87.8759079",
                "41.98209,-87.8758621",
                "41.9821091,-87.8757935",
                "41.9821701,-87.8756332",
                "41.9823494,-87.8751907",
                "41.9823799,-87.8750992",
                "41.9825897,-87.8744431"
            ],
            "id": "M1"
        }, {
            "direction": "lightRight",
            "action": "rightExit",
            "position": {
                "latitude": 41.9825897,
                "longitude": -87.8744431
            },
            "instruction": "Take exit <span class=\"junction\">#1D/I-294 S/Indiana</span> onto <span class=\"street\">Tri-State Tollway (I-294 S)</span>. <span class=\"warning\">(toll road)</span> <span class=\"distance-description\">Go for <span class=\"length\">6.5 miles</span>.</span>",
            "placeEquipment": [],
            "travelTime": 460.5,
            "length": 10853.0,
            "shape": ["41.9825897,-87.8744431",
                "41.9825897,-87.8740082",
                "41.9825706,-87.8738174",
                "41.9825287,-87.873558",
                "41.9824104,-87.8731537",
                "41.9822693,-87.872818",
                "41.9820786,-87.8724136",
                "41.9818687,-87.8720093",
                "41.9816399,-87.8716278",
                "41.981369,-87.8712616",
                "41.9810104,-87.8708572",
                "41.98069,-87.8704987",
                "41.9805183,-87.8703918",
                "41.9801712,-87.8702164",
                "41.9798012,-87.8700867",
                "41.9790611,-87.8698273",
                "41.9783516,-87.8697586",
                "41.9775581,-87.8696518",
                "41.9765816,-87.8695068",
                "41.9758186,-87.8694077",
                "41.9755516,-87.8693695",
                "41.9748993,-87.8693314",
                "41.9743195,-87.8693695",
                "41.973999,-87.8694305",
                "41.9735184,-87.8695221",
                "41.9731216,-87.8696289",
                "41.9729195,-87.8697128",
                "41.9727707,-87.8697662",
                "41.9723587,-87.869957",
                "41.9717789,-87.8702621",
                "41.9712105,-87.8706131",
                "41.9709587,-87.8707581",
                "41.9699783,-87.8714676",
                "41.9697113,-87.8716278",
                "41.9695892,-87.8717117",
                "41.9695015,-87.8717728",
                "41.9692497,-87.871933",
                "41.9686394,-87.8723373",
                "41.9681206,-87.8726807",
                "41.9668617,-87.8735199",
                "41.96661,-87.8736877",
                "41.9662895,-87.8739014",
                "41.9656181,-87.8743362",
                "41.963089,-87.8760376",
                "41.9627113,-87.8762894",
                "41.9618187,-87.8768463",
                "41.9611588,-87.8772736",
                "41.9605103,-87.8776398",
                "41.9593201,-87.8783188",
                "41.9589996,-87.87854",
                "41.9586296,-87.8787766",
                "41.9570084,-87.8798676",
                "41.9566917,-87.8800888",
                "41.9564285,-87.8802414",
                "41.9561386,-87.8804092",
                "41.9552612,-87.8809204",
                "41.955101,-87.8810196",
                "41.9542389,-87.8814697",
                "41.953331,-87.8818588",
                "41.9486198,-87.8837585",
                "41.9480515,-87.8840103",
                "41.9474716,-87.8842773",
                "41.9472084,-87.8843994",
                "41.9466705,-87.8846817",
                "41.9458694,-87.8851089",
                "41.9458008,-87.8851471",
                "41.94561,-87.8852768",
                "41.945549,-87.8853226",
                "41.9454002,-87.8854065",
                "41.9450493,-87.8856735",
                "41.9447403,-87.8859177",
                "41.9443283,-87.8862991",
                "41.9439392,-87.8867111",
                "41.943409,-87.8873291",
                "41.9432793,-87.8874969",
                "41.9431114,-87.8877335",
                "41.9427986,-87.8881683",
                "41.9427185,-87.8883133",
                "41.9426384,-87.8884277",
                "41.9425392,-87.8886032",
                "41.9424019,-87.8888626",
                "41.9422989,-87.8890381",
                "41.9421883,-87.8892593",
                "41.94207,-87.8894882",
                "41.9417305,-87.8902817",
                "41.9416504,-87.89048",
                "41.9415703,-87.8907089",
                "41.9415207,-87.8908386",
                "41.9413109,-87.8914719",
                "41.9411392,-87.8920975",
                "41.9410706,-87.8924179",
                "41.941021,-87.892662",
                "41.9408607,-87.8934631",
                "41.9404106,-87.8959732",
                "41.9400101,-87.8981934",
                "41.9394417,-87.9013367",
                "41.9389191,-87.9044876",
                "41.9379311,-87.9104919",
                "41.9376717,-87.9119873",
                "41.9375,-87.9126968",
                "41.9372902,-87.9134064",
                "41.9370499,-87.9141006",
                "41.9369392,-87.9143677",
                "41.936821,-87.9146194",
                "41.936451,-87.9153824",
                "41.9361,-87.9159775",
                "41.9357185,-87.9165421",
                "41.9353218,-87.9170685",
                "41.9348984,-87.9175415",
                "41.9342117,-87.9181824",
                "41.9334793,-87.9187317",
                "41.9329605,-87.9190369",
                "41.9324303,-87.9192886",
                "41.9320488,-87.9194336",
                "41.9315796,-87.9195938",
                "41.9313011,-87.9196625",
                "41.9305305,-87.9197922",
                "41.9299583,-87.9198074",
                "41.9281998,-87.9198074",
                "41.9211617,-87.919838",
                "41.9158592,-87.9198685",
                "41.911911,-87.919899",
                "41.9078293,-87.9199295",
                "41.9070396,-87.9199295",
                "41.9068718,-87.9199295",
                "41.9068108,-87.9199295",
                "41.9067383,-87.9199295",
                "41.9065094,-87.9199371",
                "41.9059296,-87.9199371"
            ],
            "id": "M2"
        }, {
            "direction": "lightRight",
            "action": "rightExit",
            "position": {
                "latitude": 41.9059296,
                "longitude": -87.9199371
            },
            "instruction": "Take the <span class=\"junction\">I-290 W/US-20/Rockford/IL-64</span> exit onto <span class=\"street\">Eisenhower Expy W (I-290 W)</span>. <span class=\"distance-description\">Go for <span class=\"length\">0.3 miles</span>.</span>",
            "placeEquipment": [],
            "travelTime": 21.0,
            "length": 474.0,
            "shape": ["41.9059296,-87.9199371",
                "41.9055595,-87.9200974",
                "41.9052811,-87.9202194",
                "41.9051514,-87.9203186",
                "41.9050484,-87.9204636",
                "41.9049606,-87.9206314",
                "41.9048996,-87.9208603",
                "41.9048805,-87.9210892",
                "41.9048996,-87.9213104",
                "41.9049301,-87.9214935",
                "41.9049988,-87.921669",
                "41.9051018,-87.9218369",
                "41.9051819,-87.9219589",
                "41.9053001,-87.9220963",
                "41.9054108,-87.9222488",
                "41.9055099,-87.9224167",
                "41.9058304,-87.9227066",
                "41.9060097,-87.9229126",
                "41.9062881,-87.9232483",
                "41.9064293,-87.9234238",
                "41.9064713,-87.9234619",
                "41.906601,-87.9236374",
                "41.9067192,-87.9237823"
            ],
            "id": "M3"
        }, {
            "direction": "lightRight",
            "action": "rightExit",
            "position": {
                "latitude": 41.9067192,
                "longitude": -87.9237823
            },
            "instruction": "Take exit <span class=\"junction\">#13B/IL-64 W/North Ave</span> onto <span class=\"street\">E North Ave (IL-64 W)</span>. <span class=\"distance-description\">Go for <span class=\"length\">0.3 miles</span>.</span>",
            "placeEquipment": [],
            "travelTime": 22.7,
            "length": 435.0,
            "shape": ["41.9067192,-87.9237823",
                "41.9070206,-87.9239502",
                "41.9071693,-87.9240036",
                "41.9072914,-87.9239731",
                "41.9074211,-87.9238892",
                "41.9075089,-87.9237823",
                "41.9075699,-87.9236526",
                "41.9076195,-87.9234467",
                "41.9076195,-87.9232178",
                "41.9075508,-87.9230118",
                "41.9074097,-87.9228363",
                "41.9072685,-87.9227371",
                "41.9070892,-87.922699",
                "41.906929,-87.9227676",
                "41.9067917,-87.9228973",
                "41.9067116,-87.9230804",
                "41.906601,-87.9236374",
                "41.906601,-87.923912",
                "41.9065895,-87.9241333",
                "41.9065895,-87.9249573"
            ],
            "id": "M4"
        }, {
            "direction": "lightRight",
            "action": "rightRamp",
            "position": {
                "latitude": 41.9065895,
                "longitude": -87.9249573
            },
            "instruction": "Take ramp onto <span class=\"street\">Eisenhower Expy E (I-290 E)</span> toward <span class=\"sign\">I-294 S/Chicago</span>. <span class=\"distance-description\">Go for <span class=\"length\">0.4 miles</span>.</span>",
            "placeEquipment": [],
            "travelTime": 28.7,
            "length": 635.0,
            "shape": ["41.9065895,-87.9249573",
                "41.9067001,-87.9254379",
                "41.9067802,-87.9256516",
                "41.9068489,-87.9257584",
                "41.906929,-87.9258499",
                "41.9070206,-87.9259109",
                "41.9071617,-87.9259262",
                "41.90728,-87.9258804",
                "41.907341,-87.9258118",
                "41.9073906,-87.9256363",
                "41.9073906,-87.9255295",
                "41.9073792,-87.9254303",
                "41.907341,-87.9253235",
                "41.9072113,-87.9250793",
                "41.9065895,-87.9241333",
                "41.9064484,-87.9239426",
                "41.9063797,-87.9238434",
                "41.9060402,-87.9233932",
                "41.905159,-87.9223328",
                "41.9050102,-87.9222031",
                "41.9047394,-87.9219666",
                "41.9042892,-87.9216537"
            ],
            "id": "M5"
        }, {
            "direction": "forward",
            "action": "arriveRight",
            "position": {
                "latitude": 41.9042892,
                "longitude": -87.9216537
            },
            "instruction": "Your destination on <span class=\"street\">Eisenhower Expy E (I-290 E)</span> is on the <span class=\"direction\">right</span>. <span class=\"arrivalsummary\">The trip takes <span class=\"length\">8 miles</span> and <span class=\"time\">9 mins</span>.</span>",
            "placeEquipment": [],
            "travelTime": 0.0,
            "length": 0.0,
            "id": "M6"
        }]
    }],
    "summary": {
        "distance": 12971.0,
        "trafficTime": 561.0,
        "baseTime": 561.0,
        "flags": ["motorway", "tollroad"]
    }
}