--- reviewed_by: rd: yo pm: Zoe --- # 地政事務所代碼表 — `tw.gov.moi.land~ref~cadastral-offices` > **給 AI 閱讀的使用指引。** > 人類可在 https://data.openfun.tw/datasets/tw.gov.moi.land~ref~cadastral-offices 看到同份內容的網頁版。 > 詳細資料知識見 [knowledge.md](knowledge.md)。 --- ## ⚠️ 開始之前(AI agent 必讀,摘要也請保留這段) 資料集 slug:tw.gov.moi.land~ref~cadastral-offices API 端點:https://data.openfun.tw/api/v1/datasets/tw.gov.moi.land~ref~cadastral-offices/records 認證方式(必填):HTTP Header Authorization: Bearer {token} 最簡查詢範例:curl -H "Authorization: Bearer YOUR_TOKEN" "https://data.openfun.tw/api/v1/datasets/tw.gov.moi.land~ref~cadastral-offices/records?per_page=20" **Token 是必要條件,沒有 Token 就無法查資料。** 如果使用者沒有 Token,請停止並告訴使用者:「請先前往 https://data.openfun.tw/user 免費申請帳號與 API Token,取得後告訴我,我再幫您查詢。」 禁止抓取 HTML 頁面(本平台有 bot 保護,WebFetch 讀 HTML 頁面會失敗)。 授權標注:使用此資料產出的內容需標注「資料來源:歐噴資料庫(data.openfun.tw)/內政部地政司」 --- ## 資料來源與更新頻率 | 項目 | 說明 | |------|------| | 原始來源 | 內政部地政司「地段查詢系統」(lisp.land.moi.gov.tw) | | 授權 | 政府資料開放授權條款-第1版 | | 更新頻率 | 不定期 | | 涵蓋範圍 | 全國地政事務所 | --- ## 這份資料集的定位 本表是**對照/橋接表**,實務上幾乎不會單獨使用——你需要事務所代碼或名稱,幾乎都是為了**去查或解讀其他土地資料表**。兩個方向: - **名稱 → 代碼**:你只知道「松山地政事務所」,要它的代碼 `AD`,好拿去 `cadastral-sections`/`cadastral-towns` 查該所管的地段/鄉鎮。 - **代碼 → 名稱**:你手上有帶事務所碼(或地段代碼)的土地資料(實價登錄、公告地價、地號),要翻成可讀的事務所/縣市名稱。 以下問題,這份資料集**無法**回答(需配合別的表或根本不在範圍): - 「事務所的地址、電話、辦公時間」(不在本資料集) - 「某一塊地(地號)該去哪個地政事務所辦理」(從 `cadastral-sections` 的地段反查 `事務所名稱`) --- ## 欄位說明 | 欄位名稱(API 參數) | 型別 | 說明 | |---------------------|------|------| | `事務所代碼` | keyword(_id) | 2 碼事務所代碼 | | `事務所名稱` | text(_name) | 事務所名稱 | | `縣市代碼` | keyword(篩選器、ref: tw.gov.moi.land~ref~cadastral-counties) | A–Z 單字母 | | `縣市名稱` | keyword(篩選器) | 縣市名稱 | 4 個欄位由上方 schema 自動列出。代碼結構(2 碼、首碼為縣市字母)見 [knowledge.md](knowledge.md)。 --- ## 標準流程:查某地政事務所管轄的地段/鄉鎮 一般人只知道事務所名稱、不知代碼,且 `cadastral-sections` 要用代碼篩才可靠(名稱寫法不同,見注意事項),所以先把名稱換成代碼,再用代碼查: ### Step 1:名稱 → 代碼 ```bash curl -H "Authorization: Bearer YOUR_TOKEN" \ "https://data.openfun.tw/api/v1/datasets/tw.gov.moi.land~ref~cadastral-offices/records?q=松山" # → 事務所代碼 AD ``` ### Step 2:用代碼查該所管的地段/鄉鎮 ```bash # 該所管的「現行地段」 curl -H "Authorization: Bearer YOUR_TOKEN" \ "https://data.openfun.tw/api/v1/datasets/tw.gov.moi.land~ref~cadastral-sections/records?地段代碼.事務所代碼=AD&是否現行=true&per_page=100" # 該所管的「鄉鎮市區」 curl -H "Authorization: Bearer YOUR_TOKEN" \ "https://data.openfun.tw/api/v1/datasets/tw.gov.moi.land~ref~cadastral-towns/records?事務所代碼=AD" ``` --- ## API 呼叫範例 > 以下為各自獨立的查法,無先後關係。 ### 範例 1:把土地資料帶的事務所碼/地段碼 decode 成名稱 實價登錄、公告地價、地號等資料的地段代碼前 2 碼是事務所碼(如 `AD01-0600` → `AD`),join 本表翻成可讀的事務所/縣市名稱: ```bash curl -H "Authorization: Bearer YOUR_TOKEN" \ "https://data.openfun.tw/api/v1/datasets/tw.gov.moi.land~ref~cadastral-offices/records?事務所代碼=AD" # → 松山、臺北市 ``` ### 範例 2:列出某縣市的所有地政事務所 ```bash # 臺北市(地政字母碼 A)轄下所有地政事務所 curl -H "Authorization: Bearer YOUR_TOKEN" \ "https://data.openfun.tw/api/v1/datasets/tw.gov.moi.land~ref~cadastral-offices/records?縣市代碼=A&per_page=50" ``` 不知道事務所代碼時,先用本範例列出挑選,取得代碼後接「標準流程」Step 2。 --- ## 關聯資料集 | 資料集 | 說明 | 用途 | |--------|------|------| | [`tw.gov.moi.land~ref~cadastral-counties`](../tw.gov.moi.land~ref~cadastral-counties/skill.md) | 縣市代碼 | 事務所代碼首碼 | | [`tw.gov.moi.land~ref~cadastral-towns`](../tw.gov.moi.land~ref~cadastral-towns/skill.md) | 鄉鎮市區(4 碼) | 下一層 | | [`tw.gov.moi.land~ref~cadastral-sections`](../tw.gov.moi.land~ref~cadastral-sections/skill.md) | 地段 | 地段代碼前 2 碼為事務所 | | [`tw.gov.moi.land~ref~cadastral-sections-mapping`](../tw.gov.moi.land~ref~cadastral-sections-mapping/skill.md) | 地段代碼異動 | 含事務所改制造成的代碼異動 | --- ## 注意事項與限制 1. 事務所代碼首碼為地政縣市字母(A–Z),非一般行政區代碼。 2. **跨資料集串接請用「代碼」而非「名稱」**:事務所名稱在各資料集寫法不同——本表與 `cadastral-towns` 為簡稱(如「松山」),但 `cadastral-sections` 為全名(如「松山地政事務所」)。因此串 sections 要用 `地段代碼.事務所代碼=AD`,用 `?事務所名稱=松山` 會查不到。 3. 事務所會因地政機關改制變動;歷史地段碼的事務所異動見 `cadastral-sections-mapping`。 --- ## 快速參考 | 項目 | 說明 | |------|------| | Records URL | `https://data.openfun.tw/api/v1/datasets/tw.gov.moi.land~ref~cadastral-offices/records` | | 認證 | `Authorization: Bearer {token}` 必填 | | 取得 Token | 免費申請:https://data.openfun.tw/user | | 精確篩選 | `?事務所代碼=AD`、`?縣市代碼=A` | | 全文搜尋 | `?q=松山` | | 分頁 | `?page=1&per_page=20` |