-1

Google은 지오 코딩 및 소요 시간 계산을 위해 Google을 사용하는 프로젝트를 진행하고 있습니다. 주로 잘 작동하지만 다음과 같은 경우 설명 할 수없는 동작이 나타납니다.Google geocode 및 distancematrix 불일치

Google지도를 사용하면 2 군데 사이의 경로를 3.6 마일로 올바르게 볼 수 있지만 동일한 경로에 대해 Google 거리 매트릭스를 사용하면 API가 151 마일을 반환합니다.

(URL의 난독 Google지도 API를 키)

1) 지오 우편 번호 LN68SD

https://maps.googleapis.com/maps/api/geocode/json?address=LN68SD&key=MapsAPIKey&region=uk

지오 제대로 반환 위치 53.2017314, -0.5642401 (링컨, 영국)

2) 지오 코드 코드 LN57FB

https://maps.googleapis.com/maps/api/geocode/json?address=LN57FB&key=MapsAPIKey&region=uk

012

https://www.google.co.uk/maps/dir/53.2017314,+-0.5642401/53.226509094238281,+-0.52461260557174683

가 제대로 매핑

3.6 마일 15 분

를 반환 3,516,

지오 제대로

3) 두 위치 사이의 경로를 표시, -0.5246126 (링컨, 영국) 위치 53.2265083을 반환

4) 두 위치 사이의 거리 표를 얻으십시오 :

https://maps.googleapis.com/maps/api/distancematrix/json?&origins=53.2017314,-0.5642401&destinations=53.2265090942383,-0.524612605571747,UK&key=MapsAPIKey&region=uk&mode=driving&units=imperial

distancematrix 잘못 위치를 1백50마일 떨어져 (링컨/런던)

// 20170523131103 
// https://maps.googleapis.com/maps/api/distancematrix/json?&origins=53.2017314,-0.5642401&destinations=53.2265090942383,-0.524612605571747,UK&key=MapsAPIKey&region=uk&mode=driving&units=imperial 

{ 
    "destination_addresses": [ 
    "99-101 Newington Causeway, London SE1 6BN, UK" 
    ], 
    "origin_addresses": [ 
    "1 Chancery Cl, Lincoln LN6, UK" 
    ], 
    "rows": [ 
    { 
     "elements": [ 
     { 
      "distance": { 
      "text": "151 mi", 
      "value": 243015 
      }, 
      "duration": { 
      "text": "2 hours 53 mins", 
      "value": 10354 
      }, 
      "status": "OK" 
     } 
     ] 
    } 
    ], 
    "status": "OK" 
} 

답변

2

당신은 거리 행렬 (목적지에 "UK")에 대한 요청에 오타가있는 상태. 내가 수정하면 get the expected result ("3.6 mi")

https://maps.googleapis.com/maps/api/distancematrix/json?&origins=53.2017314,-0.5642401&destinations=53.2265090942383,-0.524612605571747&region=uk&mode=driving&units=imperial 

{ 
    "destination_addresses" : [ "Waterside S, Lincoln LN5 7FB, UK" ], 
    "origin_addresses" : [ "1 Chancery Cl, Lincoln LN6, UK" ], 
    "rows" : [ 
     { 
     "elements" : [ 
      { 
       "distance" : { 
        "text" : "3.6 mi", 
        "value" : 5864 
       }, 
       "duration" : { 
        "text" : "15 mins", 
        "value" : 889 
       }, 
       "status" : "OK" 
      } 
     ] 
     } 
    ], 
    "status" : "OK" 
}