Google Directions API start_address与输入中的原点不同

时间:2016-08-14 13:25:19

标签: google-maps directions

我的Google Directions API请求是:

  

https://maps.googleapis.com/maps/api/directions/json?origin=41.43206,-81.38992&destination=41.43206,-81.48992&key=xxxxxxxx

我收到的回复是:

{
...
 "routes": [
{
  "bounds": {
    "northeast": {
      "lat": 41.4358763,
      "lng": -81.3897891
    },
    "southwest": {
      "lat": 41.4238459,
      "lng": -81.4910838
    }
  },
  "copyrights": "Map data ©2016 Google",
  "legs": [
    {
      "distance": {
        "text": "6.5 mi",
        "value": 10537
      },
      "duration": {
        "text": "14 mins",
        "value": 857
      },
      "end_address": "4743-4753 Country Ln, Warrensville Heights, OH 44128, USA",
      "end_location": {
        "lat": 41.4322651,
        "lng": -81.4910838
      },
      "start_address": "45 Bell St, Chagrin Falls, OH 44022, USA",
      "start_location": {
        "lat": 41.4318382,
        "lng": -81.3897891
      },
      "steps": [
        {
          "distance": {
            "text": "0.1 mi",
            "value": 191
          },
          "duration": {
            "text": "1 min",
            "value": 33
          },
          "end_location": {
            "lat": 41.4311157,
            "lng": -81.3918637
          },
          "html_instructions": "Head <b>southwest</b> on <b>Bell St</b> toward <b>Pleasant Dr</b>",
          "polyline": {
            "points": "_d{{FdmwoNFVRx@bA`EVbAVdA"
          },
          "start_location": {
            "lat": 41.4318382,
            "lng": -81.3897891
          },
          "travel_mode": "DRIVING"
        },
        ...
        {
          "distance": {
            "text": "0.2 mi",
            "value": 317
          },
          "duration": {
            "text": "1 min",
            "value": 32
          },
          "end_location": {
            "lat": 41.4322651,
            "lng": -81.4910838
          },
          "html_instructions": "Turn <b>left</b> onto <b>Country Ln</b><div style=\"font-size:0.9em\">Destination will be on the left</div>",
          "maneuver": "turn-left",
          "polyline": {
            "points": "ix{{FldkpNxJ?x@Ln@PnAX"
          },
          "start_location": {
            "lat": 41.4350887,
            "lng": -81.49079350000001
          },
          "travel_mode": "DRIVING"
        }
      ],
      "traffic_speed_entry": [],
      "via_waypoint": []
    }
  ],
  "overview_polyline": {
    "points": "_d{{FdmwoNvBvIVdAs@`@_Af@cCnAp@vCf@rBlAzEHd@`@nEFz@Cj@Or@{@nBUl@Q|@c@dGVZz@vAxDdGtBnDzCrEhAjCdAnCZ~Ap@bJJ`CAn@X\\\\r@hSx^hAxCn@pBXr@FbR?dCAz@ElAOhBe@xCkBvHqAtF]|BOhBG~BFpOFxBhBt\\r@vMBpA?zH?z\\CV?rV@V?nT?|QBvl@@vI@lJAdI?fDDhODxPHvq@?hB_@EgA?m@@EDyBBmCCqE?{FAkHB}E?cDEwBBcE?cKA_@?VdFl@fMp@pNd@fK@fJApCxJ?hB^nAX"
  }
...
}

为什么单腿中的起始地址与请求中指定的原点不同?这两点相距6.5英里。

对于请求中指定的end_address和destination,情况也是如此。

谢谢, Abhishek Batra

1 个答案:

答案 0 :(得分:0)

DirectionsService反向地理编码作为坐标提供的任何位置,找到路上最近的位置并将其用作原点(或目的地)。

Your two points both happen to be in the middle of water.

enter image description here enter image description here