🗺️ GIS & RS/📚 GIS (지리정보시스템)

[GIS] Google Geocoding API의 응답 데이터

김 홍시 2025. 1. 18.
반응형

Google Geocoding API의 응답 데이터는 보통 요청에 따라 약간 다를 수 있지만, 일반적인 JSON 형식의 응답 예시는 다음과 같습니다. 이 예시는 1600 Amphitheatre Parkway, Mountain View, CA 주소를 검색했을 때 반환될 수 있는 데이터입니다:

{
  "results": [
    {
      "address_components": [
        {
          "long_name": "1600",
          "short_name": "1600",
          "types": ["street_number"]
        },
        {
          "long_name": "Amphitheatre Parkway",
          "short_name": "Amphitheatre Pkwy",
          "types": ["route"]
        },
        {
          "long_name": "Mountain View",
          "short_name": "Mountain View",
          "types": ["locality", "political"]
        },
        {
          "long_name": "Santa Clara County",
          "short_name": "Santa Clara County",
          "types": ["administrative_area_level_2", "political"]
        },
        {
          "long_name": "California",
          "short_name": "CA",
          "types": ["administrative_area_level_1", "political"]
        },
        {
          "long_name": "United States",
          "short_name": "US",
          "types": ["country", "political"]
        },
        {
          "long_name": "94043",
          "short_name": "94043",
          "types": ["postal_code"]
        }
      ],
      "formatted_address": "1600 Amphitheatre Parkway, Mountain View, CA 94043, USA",
      "geometry": {
        "location": {
          "lat": 37.4224764,
          "lng": -122.0842499
        },
        "location_type": "ROOFTOP",
        "viewport": {
          "northeast": {
            "lat": 37.4238253802915,
            "lng": -122.0829009197085
          },
          "southwest": {
            "lat": 37.4211274197085,
            "lng": -122.0855988802915
          }
        }
      },
      "place_id": "ChIJ2eUgeAK6j4ARbn5u_wAGqWA",
      "types": ["street_address"]
    }
  ],
  "status": "OK"
}

주요 필드 설명:

  1. results: 검색 결과의 배열로, 여러 개의 결과가 있을 수 있습니다.
  2. address_components: 주소를 구성하는 각각의 요소 (예: 도로명, 도시, 우편번호 등).
  3. formatted_address: 사람이 읽을 수 있는 포맷으로 변환된 전체 주소.
  4. geometry:
    • location: 위도와 경도를 포함하는 주소의 중심점.
    • location_type: 위치의 정확도(예: ROOFTOP, APPROXIMATE 등).
    • viewport: 지도에서 위치를 나타내기 위한 경계 박스 좌표.
  5. place_id: 특정 장소를 고유하게 식별하는 ID.
  6. status: 요청의 상태 (예: OK, ZERO_RESULTS, OVER_QUERY_LIMIT 등).

이 예시는 API 호출 결과가 성공적(status: "OK")일 때의 응답을 보여줍니다. 실패 또는 오류 시에는 status 필드에 다른 값이 나타납니다.

 

 

 

 

반응형

댓글