API

Geospect は、公開カタログの検索や属性確認、地図タイルURLの取得を行える読み取り専用のREST APIを提供しています。

このAPIは、公式の最新データを直接配信したり、利用条件や権利関係を保証するものではありません。元データのダウンロードや商用利用、実務での利用にあたっては、必ず公式提供元のページや利用規約、仕様をご確認ください。

REST API 仕様

Base URL: https://api.geospect.jp 認証: 不要

GET /openapi.json

OpenAPI 仕様

APIのOpenAPI 3.1スキーマ定義は次のエンドポイントから取得できます。

curl -s "https://api.geospect.jp/openapi.json"
GET /v1/search

データセット検索

キーワードや地域コード・地域名から、公開カタログ内のデータセット候補を探します。

クエリパラメータ
  • q: 検索キーワード(日本語または英語。例: 浸水, 人口)
  • areas: 対象地域名または自治体コード(例: 東京都千代田区, 13101。複数可)
  • limit: 取得件数(1〜50、デフォルト 10)
  • lang: 言語(ja または en、デフォルト ja)
  • cursor: 次ページ取得用トークン(前回のレスポンスの next_cursor を指定)
リクエスト例
curl -s "https://api.geospect.jp/v1/search?q=浸水&limit=3"
レスポンス例
{
  "api_version": "v1",
  "catalog_generated_at": "2026-06-25T00:00:00Z",
  "catalog_revision": "sha256:0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef",
  "notices": [
    {
      "kind": "rights",
      "message": "License and usage conditions are not interpreted by Geospect API. Check official provider links."
    }
  ],
  "search_mode": "lexical",
  "total_count": 42,
  "results": [
    {
      "dataset_id": "PoTM",
      "title": "(データセット名)",
      "summary": "(概要)",
      "provider": { "name": "国土数値情報" },
      "geospect_links": {
        "catalog_url": "https://geospect.jp/catalog/PoTM/",
        "map_url": "https://geospect.jp/map?layers=PoTMtPkM"
      },
      "official_links": {
        "dataset_page_url": "https://…",
        "distribution_page_url": "https://…"
      }
    }
  ],
  "next_cursor": null
}
GET /v1/datasets/{id}

データセット詳細

データセットの概要、提供元、公式リンク、属性項目、地図タイルURLなどの詳細情報を取得します。

パラメータ
  • id (パス): 4文字のデータセットID(例: PoTM)
  • include (クエリ): 返却セクション(カンマ区切り、デフォルト: overview,official_links,layers,attributes_summary)
リクエスト例
curl -s "https://api.geospect.jp/v1/datasets/PoTM"
レスポンス例
{
  "api_version": "v1",
  "catalog_generated_at": "2026-06-25T00:00:00Z",
  "catalog_revision": "sha256:0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef",
  "notices": [{ "kind": "rights", "message": "…" }],
  "geospect_links": {
    "catalog_url": "https://geospect.jp/catalog/PoTM/",
    "map_url": "https://geospect.jp/map?layers=PoTMtPkM",
    "markdown_url": "https://geospect.jp/catalog/PoTM.md"
  },
  "dataset": {
    "dataset_id": "PoTM",
    "title": "(データセット名)",
    "summary": "(概要)",
    "provider": { "name": "国土数値情報", "website_url": "https://nlftp.mlit.go.jp/ksj/" },
    "categories": ["人口・世帯"],
    "spatial_units": ["都道府県"],
    "record_count": 1234,
    "data_size_label": "約 2 MB",
    "formats": ["GeoJSON", "PMTiles"]
  },
  "official_links": {
    "dataset_page_url": "https://…",
    "distribution_page_url": "https://…",
    "terms_url": "https://…"
  },
  "license": {
    "name": "政府標準利用規約(第2.0版)",
    "terms_url": "https://…"
  },
  "layers": [
    {
      "layer_id": "PoTMtPkM",
      "title": "(レイヤ名)",
      "style": "fill",
      "map_url": "https://geospect.jp/map?layers=PoTMtPkM",
      "tile_urls": {
        "documentation_url": "https://geospect.jp/tiles/",
        "style_url": "https://tiles.geospect.jp/PoTMtPkM/style.json",
        "tilejson_url": "https://tiles.geospect.jp/PoTMtPkM.json",
        "vector_url_template": "https://tiles.geospect.jp/PoTMtPkM/{z}/{x}/{y}.pbf",
        "raster_url_template": "https://tiles.geospect.jp/PoTMtPkM/{z}/{x}/{y}.png"
      }
    }
  ],
  "attributes_summary": {
    "field_count": 12,
    "inline_fields": [
      {
        "field_name": "P01_001",
        "display_name": "総人口",
        "description": "(属性の説明)"
      }
    ]
  }
}