Reverse Geocoding

Prev Next

VPC環境で利用できます。

入力した座標を住所情報(法定洞、行政洞、地番住所、道路名住所など)に変換します。

参考

Reverse Geocoding APIは、EPSG(European Petroleum Survey Group)が指定した一部座標システムと韓国で主に使用する座標システムをサポートします。サポートする座標システムの詳細は、座標システムをご参照ください。

リクエスト

リクエスト形式を説明します。リクエスト形式は次の通りです。

メソッド URI
GET /gc

リクエストヘッダ

Maps APIで共通して使用されるヘッダの詳細は、Mapsの共通ヘッダをご参照ください。

リクエストクエリパラメータ

リクエストクエリパラメータの説明は次の通りです。

フィールド タイプ 必須の有無 説明
coords String Required 座標(X座標,Y座標)
  • <例> coords=128.12345,37.98776
sourcecrs String Optional 入力座標系コード
  • EPSG:4326(デフォルト) | EPSG:3857 | NHN:2048
    • EPSG:4326: WGS84経緯度
    • EPSG:3857: Googleマップ
    • NHN:2048: UTM-K
  • サポートする座標系コードは座標システムを参照
targetcrs String Optional 出力座標系コード
  • EPSG:4326(デフォルト) | EPSG:3857 | NHN:2048
    • EPSG:4326: WGS84経緯度
    • EPSG:3857: Googleマップ
    • NHN:2048: UTM-K
  • サポートする座標系コードは座標システムを参照
orders String Optional 変換タイプ
  • legalcode(デフォルト) | admcode(デフォルト) | addr | roadaddr
    • legalcode: 法定洞に変換
    • admcode: 行政洞に変換
    • addr: 地番住所に変換
    • roadaddr: 道路名住所に変換
  • 「,」で区切って複数のオプション値を入力でき、入力順に結果を表示
  • 海岸線付近や新規宅地など、詳細住所がない地域の座標変換の際はaddrまたはroadaddrでリクエストすると結果が返されないことがあるが、legalcodeまたはadmcodeでリクエストすると法定洞または行政洞単位の住所が確認できる
  • <例> orders=legalcode,addr
output String Optional レスポンス結果の形式タイプ
  • xml(デフォルト) | json
callback String Optional コールバック名
  • JSONP通信のためにコールバック処理時に利用
  • 入力した名前で JSONデータをラップして返す
  • outputjsonの場合にのみ入力可能
  • <例> callback=abc

座標システム

座標システムの説明は次の通りです。

名前 コード 区分 GCS情報 PCS情報
Googleマップ EPSG:3857 PCS WGS_1984 WGS_1984 6378137 (Semi_Minor) 298.2572236 Greenwich Degree M 0 0 0 0 Meter 1
WGS 84経緯度 EPSG:4326 GCS WGS_1984 WGS_1984 6378137 298.2572236 Greenwich Degree - - - - - - -
UTM-K NHN:2048 PCS D_ITRF_2000 GRS_1980 6378137 298.2572221 Greenwich Degree TM 127.5 38 2,000,000 1,000,000 Meter 0.9996

リクエスト例

リクエストのサンプルコードは次の通りです。

curl --location --request GET 'https://naveropenapi.apigw.ntruss.com/map-reversegeocode/v2/gc?coords=127.585%2C34.9765&output=json&orders=legalcode%2Cadmcode%2Caddr%2Croadaddr' \
--header 'x-ncp-apigw-api-key-id: {API Key ID}' \
--header 'x-ncp-apigw-api-key: {API Key}'
参考

入力した座標に応じてさまざまなレスポンス結果が返される場合があります。次のリクエストのサンプルコードをご参照ください。

  • 一般の邑/面/洞
    • https://naveropenapi.apigw.ntruss.com/map-reversegeocode/v2/gc?request=coordsToaddr&coords=126.9913201,37.5666936&sourcecrs=epsg:4326&orders=admcode,legalcode,addr,roadaddr&output=xml
    • https://naveropenapi.apigw.ntruss.com/map-reversegeocode/v2/gc?request=coordsToaddr&coords=129.1133567,35.2982640&sourcecrs=epsg:4326&orders=admcode,legalcode,addr,roadaddr&output=xml
  • 一般の里: 法定洞単位の邑/面下位の里単位の座標はadmcodeの結果でもcodeTypeLと表示される
    • https://naveropenapi.apigw.ntruss.com/map-reversegeocode/v2/gc?request=coordsToaddr&coords=128.2439084,36.4938906&sourcecrs=epsg:4326&orders=admcode,legalcode,addr,roadaddr&output=xml
  • 領域は異なるが、法定洞と同じ名前の行政洞が存在する場合
    • https://naveropenapi.apigw.ntruss.com/map-reversegeocode/v2/gc?request=coordsToaddr&coords=127.1114893,37.3614463&sourcecrs=epsg:4326&orders=admcode,legalcode,addr,roadaddr&output=xml
  • 世宗市: 市/郡/区に関するデータが存在せず、領域は異なるが、下位のすべての行政洞の法定洞が同様に表示される
    • 世宗市オジン洞: https://naveropenapi.apigw.ntruss.com/map-reversegeocode/v2/gc?request=coordsToaddr&coords=127.2654387,36.5008113&sourcecrs=epsg:4326&orders=admcode,legalcode,addr,roadaddr&output=xm
    • 世宗市鳥致院邑: https://naveropenapi.apigw.ntruss.com/map-reversegeocode/v2/gc?request=coordsToaddr&coords=127.2923750,36.5929071&sourcecrs=epsg:4326&orders=admcode,legalcode,addr,roadaddr&output=xml
  • 海の上の座標: レスポンス結果は表示されない
    • https://naveropenapi.apigw.ntruss.com/map-reversegeocode/v2/gc?request=coordsToaddr&coords=125.9913201,37.5666936&sourcecrs=epsg:4326&orders=admcode,legalcode,addr,roadaddr&output=xml

レスポンス

レスポンス形式を説明します。

レスポンスボディ

レスポンスボディの説明は次の通りです。

フィールド タイプ 必須の有無 説明
status Object - レスポンスステータスに関する情報
status.code Integer - レスポンスステータスコード
status.name String - レスポンスステータスメッセージ
status.message String - レスポンスステータスに関する説明
results Array - 応答の結果

results

resultsの説明は次の通りです。

フィールド タイプ 必須の有無 説明
name String - 変換タイプ
code Object - コード情報
code.id String - コード ID
code.type String - コードタイプ
  • L | A | S
    • L: 法定洞
    • A: 行政洞
    • S: 領域は異なるが、同じ名前の法定洞が存在する行政洞
code.mappingId String - 法定/行政コードにマッピングされた NAVER洞コードの ID
region Object - 住所情報
region.areaN Object - 行政区域情報
  • 変換された住所の最も大きな行政区域単位から順に表示
region.areaN.name String - 行政区域単位名
  • region.area0.name: 国コードの最上位ドメインで、krと表示
  • region.area1.name: 行政安全部が公示した市/道名
  • region.area2.name: 行政安全部が公示した市/郡/区名
  • region.area3.name: 行政安全部が公示した邑/面/洞名
  • region.area4.name: 行政安全部が公示した里の名前
region.areaN.coords Object - 行政区域の位置情報
region.areaN.coords.center Object - 行政区域の中心座標
region.areaN.coords.center.crs String - 座標系コード
region.areaN.coords.center.x Float - X座標
  • land.coords.center.crsEPSG:4326の場合、経度
region.areaN.coords.center.y Float - Y座標
  • land.coords.center.crsEPSG:4326の場合、緯度
land Object - 詳細住所情報
land.type String - 地籍のタイプ
  • nameaddrの場合にのみ詳細値を表示
  • 1 | 2
    • 1: 一般の土地
    • 2: 山
land.name String - 道路名
  • nameroadaddrの場合にのみ詳細値を表示
land.number1 String - 詳細番号
  • nameaddrの場合、土地の本番号
  • nameroadaddrの場合、詳細住所
land.number2 String - 土地の副番号
  • nameaddrの場合にのみ詳細値を表示
land.coords Object - 詳細住所の位置情報
land.coords.center Object - 詳細住所の中心座標
land.coords.center.crs String - 座標系コード
land.coords.center.x Float - X座標
  • land.coords.center.crsEPSG:4326の場合、経度
land.coords.center.y Float - Y座標
  • land.coords.center.crsEPSG:4326の場合、緯度
land.additionN Object - 追加情報
  • nameroadaddrの場合にのみ詳細値を表示
  • land.addition0: 建物情報
  • land.addition1: 郵便番号情報
  • land.addition2: 道路コード情報
land.additionN.type String - 追加情報のタイプ
  • land.addition0.type: building
  • land.addition1.type: zipcode
  • land.addition2.type: roadGroupCode
land.additionN.value String - 追加情報の値
  • land.addition0.value: 建物名
  • land.addition1.value: 郵便番号
  • land.addition2.value: 道路コード(12桁)

レスポンスステータスコード

レスポンスステータスコードの説明は次の通りです。

HTTPステータスコード コード メッセージ 説明
200 0 ok リクエスト処理成功。レスポンス結果を返す
200 3 no results リクエスト処理成功。レスポンス結果を返さない
400 100 invalid request リクエストパラメータエラー
500 900 unknown error / io error 定義されていないエラー
参考

Maps APIで共通して使用されるレスポンスステータスコードの詳細は、Mapsの共通レスポンスステータスコードをご参照ください。

レスポンス例

レスポンスのサンプルコードは次の通りです。

{
    "status": {
        "code": 0,
        "name": "ok",
        "message": "done"
    },
    "results": [
        {
            "name": "legalcode",
            "code": {
                "id": "4623025024",
                "type": "L",
                "mappingId": "1223025024"
            },
            "region": {
                "area0": {
                    "name": "kr",
                    "coords": {
                        "center": {
                            "crs": "",
                            "x": 0.0,
                            "y": 0.0
                        }
                    }
                },
                "area1": {
                    "name": "全羅南道",
                    "coords": {
                        "center": {
                            "crs": "EPSG:4326",
                            "x": 126.957167,
                            "y": 34.900727
                        }
                    },
                    "alias": "全南"
                },
                "area2": {
                    "name": "光陽市",
                    "coords": {
                        "center": {
                            "crs": "EPSG:4326",
                            "x": 127.695899,
                            "y": 34.940658
                        }
                    }
                },
                "area3": {
                    "name": "光陽邑",
                    "coords": {
                        "center": {
                            "crs": "EPSG:4326",
                            "x": 127.58105,
                            "y": 34.97341
                        }
                    }
                },
                "area4": {
                    "name": "邑內里",
                    "coords": {
                        "center": {
                            "crs": "EPSG:4326",
                            "x": 127.5863,
                            "y": 34.9751
                        }
                    }
                }
            }
        },
        {
            "name": "admcode",
            "code": {
                "id": "4623025000",
                "type": "L",
                "mappingId": "12230250"
            },
            "region": {
                "area0": {
                    "name": "kr",
                    "coords": {
                        "center": {
                            "crs": "",
                            "x": 0.0,
                            "y": 0.0
                        }
                    }
                },
                "area1": {
                    "name": "全羅南道",
                    "coords": {
                        "center": {
                            "crs": "EPSG:4326",
                            "x": 126.957167,
                            "y": 34.900727
                        }
                    },
                    "alias": "全南"
                },
                "area2": {
                    "name": "光陽市",
                    "coords": {
                        "center": {
                            "crs": "EPSG:4326",
                            "x": 127.695899,
                            "y": 34.940658
                        }
                    }
                },
                "area3": {
                    "name": "光陽邑",
                    "coords": {
                        "center": {
                            "crs": "EPSG:4326",
                            "x": 127.58105,
                            "y": 34.97341
                        }
                    }
                },
                "area4": {
                    "name": "",
                    "coords": {
                        "center": {
                            "crs": "",
                            "x": 0.0,
                            "y": 0.0
                        }
                    }
                }
            }
        },
        {
            "name": "addr",
            "code": {
                "id": "4623025024",
                "type": "L",
                "mappingId": "1223025024"
            },
            "region": {
                "area0": {
                    "name": "kr",
                    "coords": {
                        "center": {
                            "crs": "",
                            "x": 0.0,
                            "y": 0.0
                        }
                    }
                },
                "area1": {
                    "name": "全羅南道",
                    "coords": {
                        "center": {
                            "crs": "EPSG:4326",
                            "x": 126.957167,
                            "y": 34.900727
                        }
                    },
                    "alias": "全南"
                },
                "area2": {
                    "name": "光陽市",
                    "coords": {
                        "center": {
                            "crs": "EPSG:4326",
                            "x": 127.695899,
                            "y": 34.940658
                        }
                    }
                },
                "area3": {
                    "name": "光陽邑",
                    "coords": {
                        "center": {
                            "crs": "EPSG:4326",
                            "x": 127.58105,
                            "y": 34.97341
                        }
                    }
                },
                "area4": {
                    "name": "邑內里",
                    "coords": {
                        "center": {
                            "crs": "EPSG:4326",
                            "x": 127.5863,
                            "y": 34.9751
                        }
                    }
                }
            },
            "land": {
                "type": "1",
                "number1": "252",
                "number2": "1",
                "addition0": {
                    "type": "",
                    "value": ""
                },
                "addition1": {
                    "type": "",
                    "value": ""
                },
                "addition2": {
                    "type": "",
                    "value": ""
                },
                "addition3": {
                    "type": "",
                    "value": ""
                },
                "addition4": {
                    "type": "",
                    "value": ""
                },
                "coords": {
                    "center": {
                        "crs": "",
                        "x": 0.0,
                        "y": 0.0
                    }
                }
            }
        },
        {
            "name": "roadaddr",
            "code": {
                "id": "4623025024",
                "type": "L",
                "mappingId": "1223025024"
            },
            "region": {
                "area0": {
                    "name": "kr",
                    "coords": {
                        "center": {
                            "crs": "",
                            "x": 0.0,
                            "y": 0.0
                        }
                    }
                },
                "area1": {
                    "name": "全羅南道",
                    "coords": {
                        "center": {
                            "crs": "EPSG:4326",
                            "x": 126.957167,
                            "y": 34.900727
                        }
                    },
                    "alias": "全南"
                },
                "area2": {
                    "name": "光陽市",
                    "coords": {
                        "center": {
                            "crs": "EPSG:4326",
                            "x": 127.695899,
                            "y": 34.940658
                        }
                    }
                },
                "area3": {
                    "name": "光陽邑",
                    "coords": {
                        "center": {
                            "crs": "EPSG:4326",
                            "x": 127.58105,
                            "y": 34.97341
                        }
                    }
                },
                "area4": {
                    "name": "邑內里",
                    "coords": {
                        "center": {
                            "crs": "EPSG:4326",
                            "x": 127.5863,
                            "y": 34.9751
                        }
                    }
                }
            },
            "land": {
                "type": "",
                "number1": "20",
                "number2": "",
                "addition0": {
                    "type": "building",
                    "value": ""
                },
                "addition1": {
                    "type": "zipcode",
                    "value": "57742"
                },
                "addition2": {
                    "type": "roadGroupCode",
                    "value": "462304655159"
                },
                "addition3": {
                    "type": "",
                    "value": ""
                },
                "addition4": {
                    "type": "",
                    "value": ""
                },
                "name": "メイルシジャンギル",
                "coords": {
                    "center": {
                        "crs": "",
                        "x": 0.0,
                        "y": 0.0
                    }
                }
            }
        }
    ]
}