2017-12-03 14 views
-1

maps.googleapis 호출에서 json 리턴의 하위 세트를 가져 오려고합니다. I가 GET 요청 만들면maps.googleapis의 필드 지정자를 사용 하시겠습니까?

"location" : { 
    "lat" : 44.0581728, 
    "lng" : -121.3153096 
} 

: 아래의 전류 리턴 본문에 상세하게 위치

{ 
    "results" : [ 
     { 
     "address_components" : [ 
      { 
       "long_name" : "Bend", 
       "short_name" : "Bend", 
       "types" : [ "locality", "political" ] 
      }, 
      { 
       "long_name" : "Deschutes County", 
       "short_name" : "Deschutes County", 
       "types" : [ "administrative_area_level_2", "political" ] 
      }, 
      { 
       "long_name" : "Oregon", 
       "short_name" : "OR", 
       "types" : [ "administrative_area_level_1", "political" ] 
      }, 
      { 
       "long_name" : "United States", 
       "short_name" : "US", 
       "types" : [ "country", "political" ] 
      } 
     ], 
     "formatted_address" : "Bend, OR, USA", 
     "geometry" : { 
      "bounds" : { 
       "northeast" : { 
        "lat" : 44.1231839, 
        "lng" : -121.248579 
       }, 
       "southwest" : { 
        "lat" : 43.999089, 
        "lng" : -121.3807099 
       } 
      }, 
      "location" : { 
       "lat" : 44.0581728, 
       "lng" : -121.3153096 
      }, 
      "location_type" : "APPROXIMATE", 
      "viewport" : { 
       "northeast" : { 
        "lat" : 44.1231839, 
        "lng" : -121.248579 
       }, 
       "southwest" : { 
        "lat" : 43.999089, 
        "lng" : -121.3807099 
       } 
      } 
     }, 
     "place_id" : "ChIJUdLTpf_AuFQRtNEgx6zniBA", 
     "types" : [ "locality", "political" ] 
     } 
    ], 
    "status" : "OK" 
} 

I은 ​​& 필드 = 위치를 추가하는 시도 : http://maps.googleapis.com/maps/api/geocode/json?address=bend&sensor=false 이 결과 get 요청에하지만 동일한 정보를 반환합니다. 내가 https://developers.google.com/maps/documentation/geocoding/intro#GeocodingRequests

에 이렇게 명확한 방법을 볼 수 없습니다 어떤 도움 감사합니다! 감사합니다.

답변

0

필요한 위치가 지오메트리에 있습니다. JSON 객체는 geometry 필드 아래에 location 속성을 가지고 있습니다.

+0

고맙습니다. 나는 파싱을하지 않도록 위치를 리턴하라는 요청을 원한다. 비록 요청을하지만 그것을 지정하는 방법을 잘 모르겠습니다 ... Logged – jmurray