Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions models/geocoding/GeocodingResult/catalog.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
title:
ja: ジオコーディングの結果
en: Geocoding result
description:
ja: 1 つの住所をジオコーディングした結果です。住所は datamodels.jp の JapaneseAddress、座標は点で表します。そのうえで、入力のどこまでが一致したか(matchLevel)、座標がどの単位のものか(coordinateLevel)、どのジオコーダーとどの版のデータを使ったかを持ちます。一致の単位はジオコーダーごとに書き方が違うので、共通の値に置き換え、元の書き方は matchLevelLabel に残します。
en: "The result of geocoding one address. The address is datamodels.jp's JapaneseAddress and the coordinates are a point. On top of that it records how much of the input matched (matchLevel), which part of the address the coordinates belong to (coordinateLevel), and which geocoder and which version of the data were used. Every geocoder writes its match levels differently, so they are mapped to shared values, and the geocoder's own wording stays in matchLevelLabel."
status: experimental
attributes:
query:
ja: ジオコーダーに渡した住所の文字列(そのまま)
en: The address text given to the geocoder, unchanged
address:
ja: 一致した住所。datamodels.jp の JapaneseAddress です。ジオコーダーが正規化した 1 行の住所は addressText に入れます。
en: The matched address, as datamodels.jp's JapaneseAddress. The geocoder's normalised one-line address goes in addressText
unmatchedParts:
ja: 入力のうち一致しなかった部分(入力の順)。たとえば建物名や階
en: Parts of the input that did not match, in input order, such as a building name or a floor
matchLevel:
ja: "一致した最も細かい単位:prefecture(都道府県)、city(郡・市区町村)、machiaza(大字・町)、machiazaDetail(丁目・小字)、residentialBlock(街区符号)、residentialNumber(住居番号)、parcel(地番)。parcel は住居表示の 2 つの単位(residentialBlock、residentialNumber)の代わりになるもので、それより細かいわけではありません。当てはまる値が無いときは省き、ジオコーダーの値を matchLevelLabel に入れます。"
en: "The most detailed part of the address that matched: prefecture, city (county or municipality), machiaza (大字・町), machiazaDetail (丁目・小字), residentialBlock (街区符号, block number), residentialNumber (住居番号, residence number), parcel (地番, lot number). parcel is an alternative to the two residential levels (residentialBlock, residentialNumber), not more detailed than them. Left out when no value fits; the geocoder's own value goes in matchLevelLabel"
coordinateLevel:
ja: 座標がどの単位のものか。値は matchLevel と同じです。matchLevel より粗いことがあります(住居番号まで一致しても、座標は町の代表点しか無いときなど)。
en: "Which part of the address the coordinates belong to, with the same values as matchLevel. It can be less detailed than matchLevel: the address may match down to the residence number while the geocoder only has a point for the town"
matchLevelLabel:
ja: ジオコーダーが返した一致の単位をそのまま、文字列で。数値で返すジオコーダーでは文字列にします(例:rsdtdsp_rsdt、"3")。
en: 'The match level as the geocoder returns it, unchanged, as text: a geocoder that returns a number gives it as text (for example rsdtdsp_rsdt, or "3")'
geocoder:
ja: 結果を出したジオコーダーの名前
en: Name of the geocoder that made the result
geocoderVersion:
ja: ジオコーダーの版
en: Version of the geocoder
datasetVersion:
ja: ジオコーダーが使った住所データの版
en: Version of the address data the geocoder used
dateGeocoded:
ja: ジオコーディングした日時
en: When the address was geocoded
location:
ja: ジオコーダーが求めた点(GeoJSON の Point)
en: The point the geocoder found, as a GeoJSON Point
34 changes: 34 additions & 0 deletions models/geocoding/GeocodingResult/examples/example.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"id": "urn:ngsi-ld:GeocodingResult:kioicho-1-3",
"type": "GeocodingResult",
"query": "東京都千代田区紀尾井町1番3号 東京ガーデンテラス紀尾井町 19階、20階",
"address": {
"addressCountry": "JP",
"addressRegion": "東京都",
"addressLocality": "千代田区",
"machiaza": "紀尾井町",
"banchi": "1",
"go": "3",
"residentialIndication": true,
"localGovernmentCode": "131016",
"abrMachiazaId": "0056000",
"addressText": "東京都千代田区紀尾井町1-3"
},
"unmatchedParts": [
"東京ガーデンテラス紀尾井町",
"19階、20階"
],
"matchLevel": "residentialNumber",
"coordinateLevel": "residentialNumber",
"matchLevelLabel": "rsdtdsp_rsdt",
"geocoder": "abr-geocoder",
"geocoderVersion": "3.0.22",
"datasetVersion": "3.0.18",
"location": {
"type": "Point",
"coordinates": [
139.736394597,
35.679107172
]
}
}
85 changes: 85 additions & 0 deletions models/geocoding/GeocodingResult/mapping/abr-geocoder.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
standard:
name:
ja: デジタル庁 abr-geocoder(v3)の /geocode の結果
en: The /geocode result of the Digital Agency's abr-geocoder (v3)
url: https://github.com/digital-go-jp/abr-geocoder
license:
ja: MIT ライセンス(ソフトウェア)
en: MIT licence (the software)
note:
ja: アドレス・ベース・レジストリを使うジオコーダー。結果は GeoJSON の FeatureCollection で、候補ごとに 1 つの Feature。1 つの Feature が 1 つの GeocodingResult になる。id は結果に無いので、呼び出した側が候補ごとに重ならない id を作る(例:urn:ngsi-ld:GeocodingResult:<リクエストの id>-<候補の順番>)。フィールドは abrg/openapi/openapi.yml で 2026-10-29 に確認(リリース 3.0.52 の時点)。例の geocoderVersion と datasetVersion は openapi.yml の例の値で、実際に動かした結果ではない。abr-geocoder が null を返す項目は、エンティティでは省く(null のままでは検証を通らない)。properties.score は入れない(notes.yaml を参照)。この表は対応を説明するもので、datamodels convert で変換するためのものではない(結果は CSV ではなく JSON)。
en: "A geocoder that uses the Address Base Registry. The result is a GeoJSON FeatureCollection with one Feature per candidate; each Feature becomes one GeocodingResult. The result has no id, so the caller makes one per candidate that no other result uses (for example urn:ngsi-ld:GeocodingResult:<request id>-<candidate number>). Fields checked in abrg/openapi/openapi.yml on 2026-10-29 (release 3.0.52). The example's geocoderVersion and datasetVersion are the sample values in openapi.yml, not from a real run. A field abr-geocoder returns as null is left out of the entity (null does not pass validation). properties.score is not kept (see notes.yaml). This table explains the correspondence; it is not a conversion for datamodels convert (the result is JSON, not CSV)."
fields:
query:
to: query.address
location:
to: features[].geometry
note:
ja: null のとき(一致しなかったとき)は省く
en: Left out when null (nothing matched)
matchLevel:
to: properties.match_level
note:
ja: pref→prefecture、city→city、machiaza→machiaza、machiaza_detail→machiazaDetail、rsdtdsp_blk→residentialBlock、rsdtdsp_rsdt→residentialNumber、parcel→parcel、unknown→省く
en: pref→prefecture, city→city, machiaza→machiaza, machiaza_detail→machiazaDetail, rsdtdsp_blk→residentialBlock, rsdtdsp_rsdt→residentialNumber, parcel→parcel, unknown→left out
coordinateLevel:
to: properties.coordinates_level
note:
ja: matchLevel と同じ対応。unknown と null は省く。
en: Same values as matchLevel; unknown and null are left out
matchLevelLabel:
to: properties.match_level
unmatchedParts:
to: properties.unmatched_address
note:
ja: すべて一致したときは null なので省く
en: null when everything matched, then left out
geocoder:
to: null
note: { ja: 結果には無い。常に abr-geocoder, en: not in the result; always abr-geocoder }
value: abr-geocoder
geocoderVersion:
to: result_info.api_version
datasetVersion:
to: result_info.db_version
dateGeocoded:
to: null
note:
ja: 結果には無い。呼び出した側が、ジオコーディングした日時を入れる
en: not in the result; the caller sets the time it geocoded
address.addressText:
to: properties.matched_address
address.addressRegion:
to: structured_address.pref
address.addressLocality:
to: structured_address.county、city、ward
note:
ja: 郡、市町村、政令市の区をつなげる(例:横浜市中区)
en: County, municipality and ward of a designated city joined (for example 横浜市中区)
address.machiaza:
to: structured_address.oaza_cho、koaza
note:
ja: 大字・町と小字をつなげる。京都の通り名(kyoto_st)は addressText にだけ残る。同一町字識別情報(machiaza_dist)は入れない:町字を区別するのは abrMachiazaId。
en: "Oaza/town and koaza joined. Kyoto street names (kyoto_st) stay only in addressText. machiaza_dist (which tells apart towns with the same name) is not kept: abrMachiazaId identifies the town"
address.chome:
to: structured_address.chome
note:
ja: abr-geocoder は「一丁目」のような書き方を返すことがある。JapaneseAddress では算用数字だけなので、変換する側が「丁目」を取り、漢数字を算用数字にする(「一丁目」→「1」、「十二丁目」→「12」、「二十丁目」→「20」)。
en: "abr-geocoder can return the chome as written, such as 一丁目. JapaneseAddress takes digits only, so the converter drops 丁目 and turns kanji numerals into digits (一丁目 → 1, 十二丁目 → 12, 二十丁目 → 20)"
address.banchi:
to: structured_address.blk_num、prc_num1〜3
note:
ja: 住居表示では街区符号(blk_num)。地番では prc_num1〜3 をハイフンでつなげる(例:4638-1)。
en: In a residential-indication area the block number (blk_num); for a lot number, prc_num1 to 3 joined with hyphens (for example 4638-1)
address.go:
to: structured_address.rsdt_num、rsdt_num2
note:
ja: 住居番号。枝番(rsdt_num2)があればハイフンでつなげる。地番のときは空。
en: The residence number, with its branch number (rsdt_num2) joined by a hyphen when there is one. Empty for a lot number
address.residentialIndication:
to: ids.rsdt_addr_flg
note: { ja: 1→true、0→false、null(町字までの一致など)→省く, en: "1→true, 0→false, null (for example a match down to the town only)→left out" }
address.localGovernmentCode:
to: ids.lg_code
address.abrMachiazaId:
to: ids.machiaza_id
15 changes: 15 additions & 0 deletions models/geocoding/GeocodingResult/notes.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
notes:
- ja: 住所の部分は新しく定義せず、datamodels.jp の JapaneseAddress(デジタル庁 GIF のコアデータモデル「住所」をもとにしたもの)をそのまま使います。このモデルが加えるのは、ジオコーディングの処理についての情報だけです(2026-10-29)。
en: "The address part is not defined again: it is datamodels.jp's JapaneseAddress, which is based on the Digital Agency's GIF core data model for addresses. This model only adds what the geocoding did (2026-10-29)."
- ja: 一致の単位の値は、デジタル庁の abr-geocoder(v3)の match_level をもとにしています。8 つのうち unknown 以外の 7 つを、読みやすい名前で 1 対 1 に対応させています(対応表は mapping/abr-geocoder.yaml)。ほかのジオコーダーは、それぞれの単位をこの値に対応させます。単位の数や書き方(数字、名前)はジオコーダーごとに違い、アプリがそれを直接読むと、ジオコーダーを替えたときに動かなくなるためです。
en: "The match level values are based on match_level of the Digital Agency's abr-geocoder (v3): its seven values other than unknown, one to one, with readable names (table in mapping/abr-geocoder.yaml). Other geocoders map their own levels to these values. The number of levels and how they are written (numbers, names) differ between geocoders, and an application that reads them directly stops working when the geocoder is replaced."
- ja: 一致しなかったとき(abr-geocoder の unknown)は matchLevel を省きます。近い値に無理に当てはめないためです。ジオコーダーの値は matchLevelLabel に残ります。
en: "When nothing matched (unknown in abr-geocoder), matchLevel is left out rather than forced to the nearest value; the geocoder's value stays in matchLevelLabel."
- ja: abr-geocoder の score は入れていません。abr-geocoder 自身が、候補を並べ替えるための参考値で、一致の正しさを表さないと説明しているからです。ほかのジオコーダーのスコアとも比べられません。
en: "abr-geocoder's score is not included: abr-geocoder describes it as a value for ordering candidates that does not say whether the match is right, and it cannot be compared with other geocoders' scores."
- ja: 入れていないもの:地域メッシュコード(JIS X 0410)や郵便番号の検索結果などの付加情報。ジオコーダーによって持っているものが違うので、必要になったら足すか、extend で拡張します。
en: "Not included yet: extra information such as the grid square code (JIS X 0410) or a postal code lookup. Geocoders differ in what they offer, so these are added when needed, or in an extension (extend)."
- ja: 検討したもの:GeocodeJSON(Pelias、Photon などが使う GeoJSON の拡張)。国際的な仕様ですが、日本の住所の単位(町字、街区符号、住居番号、地番)を表せず、使っているツールも少ないため、使っていません。
en: "Considered: GeocodeJSON (a GeoJSON extension used by Pelias, Photon and others). It is international, but it has no levels for Japanese addresses (machiaza, block number, residence number, lot number) and few tools use it, so it is not used here."
- ja: このノードで試す段階(experimental)です。
en: Experimental, tried in this node first.
142 changes: 142 additions & 0 deletions models/geocoding/GeocodingResult/schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://models.geolonia.com/schema/geocoding/GeocodingResult/v0.1.0.json",
"title": "GeocodingResult",
"description": "The result of geocoding one address: the address as a JapaneseAddress, the point, and what the geocoding did (how much of the input matched, from which level the coordinates come, which geocoder and data)",
"type": "object",
"properties": {
"id": {
"type": "string",
"format": "uri",
"description": "Entity id (URN)"
},
"type": {
"type": "string",
"const": "GeocodingResult",
"description": "Entity type"
},
"query": {
"type": "string",
"minLength": 1,
"description": "The address text given to the geocoder, unchanged",
"x-ngsi": {
"type": "Property"
},
"x-iri": "https://models.geolonia.com/ns/geocoding#query"
},
"address": {
"$ref": "https://datamodels.jp/schema/common/JapaneseAddress/v1.0.0.json",
"description": "The matched address, as a JapaneseAddress value (datamodels.jp common subject). addressText holds the geocoder's normalised address line",
"x-ngsi": {
"type": "Property",
"model": "https://datamodels.jp/ns/common/JapaneseAddress"
},
"x-iri": "https://schema.org/address"
},
"unmatchedParts": {
"type": "array",
"items": {
"type": "string"
},
"description": "Parts of the input the geocoder could not match, in input order (for example a building name and floor)",
"x-ngsi": {
"type": "Property"
},
"x-iri": "https://models.geolonia.com/ns/geocoding#unmatchedParts"
},
"matchLevel": {
"type": "string",
"enum": [
"prefecture",
"city",
"machiaza",
"machiazaDetail",
"residentialBlock",
"residentialNumber",
"parcel"
],
"description": "The most detailed level of the address that matched. parcel (a lot number) is an alternative to the two residential levels, not more detailed than them. Left out when no value fits; the geocoder's own value is in matchLevelLabel",
"x-ngsi": {
"type": "Property"
},
"x-iri": "https://models.geolonia.com/ns/geocoding#matchLevel"
},
"coordinateLevel": {
"type": "string",
"enum": [
"prefecture",
"city",
"machiaza",
"machiazaDetail",
"residentialBlock",
"residentialNumber",
"parcel"
],
"description": "The level of the address the coordinates belong to. Can be less detailed than matchLevel, for example when the geocoder only has a point for the town",
"x-ngsi": {
"type": "Property"
},
"x-iri": "https://models.geolonia.com/ns/geocoding#coordinateLevel"
},
"matchLevelLabel": {
"type": "string",
"description": "The match level as the geocoder writes it, unchanged, as text: a geocoder that returns a number gives it as text (for example rsdtdsp_rsdt, or \"3\")",
"x-ngsi": {
"type": "Property"
},
"x-iri": "https://models.geolonia.com/ns/geocoding#matchLevelLabel"
},
"geocoder": {
"type": "string",
"description": "Name of the geocoder that made the result",
"x-ngsi": {
"type": "Property"
},
"x-iri": "https://models.geolonia.com/ns/geocoding#geocoder"
},
"geocoderVersion": {
"type": "string",
"description": "Version of the geocoder",
"x-ngsi": {
"type": "Property"
},
"x-iri": "https://models.geolonia.com/ns/geocoding#geocoderVersion"
},
"datasetVersion": {
"type": "string",
"description": "Version of the address data the geocoder used",
"x-ngsi": {
"type": "Property"
},
"x-iri": "https://models.geolonia.com/ns/geocoding#datasetVersion"
},
"dateGeocoded": {
"type": "string",
"format": "date-time",
"description": "When the address was geocoded",
"x-ngsi": {
"type": "Property"
},
"x-iri": "https://models.geolonia.com/ns/geocoding#dateGeocoded"
},
"location": {
"$ref": "https://datamodels.jp/schema/common/Geometry/v1.0.0.json",
"properties": {
"type": {
"const": "Point"
}
},
"description": "The point the geocoder found, as a GeoJSON Point",
"x-ngsi": {
"type": "GeoProperty",
"model": "https://datamodels.jp/ns/common/Geometry"
},
"x-iri": "https://uri.etsi.org/ngsi-ld/location"
}
},
"required": [
"id",
"type",
"query"
]
}
Loading
Loading