{"openapi":"3.0.3","info":{"title":"IIIF → WMTS Proxy API","version":"0.2.0","description":"IIIF Image API サーバを WMTS-style にプロキシ。ピクセル空間と地理座標 (allmaps.xyz 経由 / 自前レンダリング) の両モードに対応。"},"servers":[{"url":"https://nakamura196-projects.vercel.app"}],"tags":[{"name":"pixel-wmts","description":"ピクセル空間 WMTS"},{"name":"geo-wmts","description":"地理座標 WMTS (allmaps.xyz / 自前 render)"},{"name":"features","description":"GeoJSON FeatureCollection"},{"name":"iiif","description":"IIIF reverse proxy (UA注入)"},{"name":"georef","description":"Georeference Annotation"},{"name":"meta","description":"メタ情報"}],"components":{"parameters":{"SlugPath":{"name":"slug","in":"path","required":true,"schema":{"type":"string","enum":["iiif-geo"]},"example":"iiif-geo"},"GeoSlugPath":{"name":"slug","in":"path","required":true,"schema":{"type":"string","enum":["iiif-geo"]},"example":"iiif-geo"},"Z":{"name":"z","in":"path","required":true,"schema":{"type":"integer"},"example":16},"X":{"name":"x","in":"path","required":true,"schema":{"type":"integer"},"example":58210},"Y":{"name":"y","in":"path","required":true,"schema":{"type":"string"},"example":"25799"},"I":{"name":"i","in":"path","required":true,"schema":{"type":"integer"},"example":128},"J":{"name":"j","in":"path","required":true,"schema":{"type":"string"},"example":"128"}},"schemas":{"WmtsInfo":{"type":"object","properties":{"id":{"type":"string"},"width":{"type":"integer"},"height":{"type":"integer"},"tileSize":{"type":"integer"},"maxZ":{"type":"integer"},"resolutions":{"type":"array","items":{"type":"number"}},"matrices":{"type":"array","items":{"type":"object","properties":{"identifier":{"type":"string"},"matrixWidth":{"type":"integer"},"matrixHeight":{"type":"integer"},"imgWidth":{"type":"integer"},"imgHeight":{"type":"integer"},"scale":{"type":"number"}}}}},"example":{"id":"iiif-geo","width":18415,"height":12911,"tileSize":512,"maxZ":7,"resolutions":[128,64,32,16,8,4,2,1],"matrices":[{"identifier":"0","matrixWidth":1,"matrixHeight":1,"imgWidth":144,"imgHeight":101,"scale":128},{"identifier":"7","matrixWidth":36,"matrixHeight":26,"imgWidth":18415,"imgHeight":12911,"scale":1}]}},"PixelFeatureCollection":{"type":"object","properties":{"type":{"type":"string","enum":["FeatureCollection"]},"crs":{"type":"object"},"features":{"type":"array","items":{"type":"object"}}},"example":{"type":"FeatureCollection","crs":{"name":"image-pixel","origin":"top-left"},"features":[{"type":"Feature","id":"https://example.org/places/gcp-1","properties":{"text":"GCP 1","id":"https://example.org/places/gcp-1","properties":{"resourceCoords":[6690,7517],"title":"GCP 1"}},"geometry":{"type":"Point","coordinates":[6690,7517]}}]}},"GeoFeatureCollection":{"type":"object","properties":{"type":{"type":"string","enum":["FeatureCollection"]},"features":{"type":"array","items":{"type":"object"}}},"example":{"type":"FeatureCollection","features":[{"type":"Feature","id":"https://example.org/places/gcp-1","properties":{"text":"GCP 1","id":"https://example.org/places/gcp-1"},"geometry":{"type":"Point","coordinates":[139.76193465,35.71332685]}}]}},"GeoInfo":{"type":"object","properties":{"center":{"type":"array","items":{"type":"number"},"minItems":2,"maxItems":2},"bounds":{"type":"array","items":{"type":"number"},"minItems":4,"maxItems":4},"gcpCount":{"type":"integer"}},"example":{"center":[139.76193465,35.71332685],"bounds":[139.7593041,35.7081704,139.7645652,35.7184833],"gcpCount":27}},"GeorefAnnotation":{"type":"object","example":{"@context":["http://www.w3.org/ns/anno.jsonld","http://iiif.io/api/extension/georef/1/context.json"],"type":"Annotation","id":"https://example.org/iiif/georef-annotation/1","motivation":"georeferencing","target":{"type":"SpecificResource","source":{"id":"https://iiif.dl.itc.u-tokyo.ac.jp/iiif/2/agriculture_re%2Fnou_tatemonochokanzu%2F0002.tif","type":"ImageService2","width":18415,"height":12911},"selector":{"type":"SvgSelector","value":"<svg width=\"18415\" height=\"12911\"><polygon points=\"0,0 18415,0 18415,12911 0,12911\" /></svg>"}},"body":{"type":"FeatureCollection","transformation":{"type":"polynomial","options":{"order":1}},"features":[{"type":"Feature","properties":{"resourceCoords":[6690,7517],"title":"GCP 1"},"geometry":{"type":"Point","coordinates":[139.76193465,35.71332685]}}]}}}}},"paths":{"/api/iiif-wmts/wmts/{id}/info":{"get":{"tags":["pixel-wmts","meta"],"summary":"ピクセル空間 WMTS のメタ情報 (proxy 形式)","description":"OpenLayers の WMTSTileGrid 初期化に必要な width / height / tileSize / scaleFactors / matrices を返す。","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"example":"iiif-geo","description":"registry slug もしくは生の IIIF image id（URL エンコード済み）"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WmtsInfo"}}}}}}},"/api/iiif-wmts/wmts/{id}/capabilities":{"get":{"tags":["pixel-wmts"],"summary":"WMTS GetCapabilities XML","description":"QGIS 等の WMTS クライアントが最初に取得するメタデータ XML。","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"example":"iiif-geo"}],"responses":{"200":{"description":"OK","content":{"application/xml":{"example":"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Capabilities xmlns=\"http://www.opengis.net/wmts/1.0\" version=\"1.0.0\">\n  <ows:ServiceIdentification>\n    <ows:Title>IIIF→WMTS Proxy</ows:Title>\n  </ows:ServiceIdentification>\n  <!-- ... -->\n</Capabilities>"}}}}}},"/api/iiif-wmts/wmts/{id}/{z}/{x}/{y}":{"get":{"tags":["pixel-wmts"],"summary":"WMTS GetTile (ピクセル空間)","description":"IIIF Image API の region/size リクエストに変換して JPEG タイルを返す。例: `/wmts/iiif-geo/3/4/2`","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"example":"iiif-geo"},{"name":"z","in":"path","required":true,"schema":{"type":"integer"},"example":3},{"name":"x","in":"path","required":true,"schema":{"type":"integer"},"example":4},{"name":"y","in":"path","required":true,"schema":{"type":"string"},"example":"2"}],"responses":{"200":{"description":"JPEG タイル","content":{"image/jpeg":{}}}}}},"/api/iiif-wmts/wmts/{id}/{z}/{x}/{y}/{i}/{j}":{"get":{"tags":["pixel-wmts","features"],"summary":"WMTS GetFeatureInfo (ピクセル空間)","description":"タイル内 (i,j) のピクセル座標から該当 annotation を返す。id は registry slug を指定。","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","enum":["iiif-geo"]},"example":"iiif-geo"},{"$ref":"#/components/parameters/Z"},{"$ref":"#/components/parameters/X"},{"$ref":"#/components/parameters/Y"},{"$ref":"#/components/parameters/I"},{"$ref":"#/components/parameters/J"},{"name":"format","in":"query","schema":{"type":"string","enum":["geojson","json","html"]},"example":"geojson"}],"responses":{"200":{"description":"GeoJSON or HTML","content":{"application/geo+json":{"schema":{"$ref":"#/components/schemas/PixelFeatureCollection"}},"text/html":{"example":"<!doctype html><meta charset=\"utf-8\"><ul><li><strong>GCP 1</strong></li></ul>"}}}}}},"/api/iiif-wmts/features/pixel/{slug}":{"get":{"tags":["features"],"summary":"全 annotation を画像ピクセル座標 GeoJSON で返却","description":"xywh ある場合は Polygon、resourceCoords だけの場合は Point として返す。","parameters":[{"$ref":"#/components/parameters/SlugPath"}],"responses":{"200":{"description":"FeatureCollection","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PixelFeatureCollection"}}}}}}},"/api/iiif-wmts/geo-wmts/{slug}/{z}/{x}/{y}":{"get":{"tags":["geo-wmts"],"summary":"地理座標 WMTS GetTile (allmaps.xyz 経由)","description":"内部で allmaps.xyz の `?url=<我々のannotation URL>` を呼ぶ。本番では高速だが localhost からは reach 不可。","parameters":[{"$ref":"#/components/parameters/GeoSlugPath"},{"$ref":"#/components/parameters/Z"},{"$ref":"#/components/parameters/X"},{"$ref":"#/components/parameters/Y"}],"responses":{"200":{"description":"PNG タイル","content":{"image/png":{}}}}}},"/api/iiif-wmts/geo-wmts-self/{slug}/{z}/{x}/{y}":{"get":{"tags":["geo-wmts"],"summary":"地理座標 WMTS GetTile (自前レンダリング)","description":"@allmaps/render を Node Runtime で直接呼ぶ。allmaps.xyz に依存しないので localhost でも動作。","parameters":[{"$ref":"#/components/parameters/GeoSlugPath"},{"$ref":"#/components/parameters/Z"},{"$ref":"#/components/parameters/X"},{"$ref":"#/components/parameters/Y"}],"responses":{"200":{"description":"PNG タイル","content":{"image/png":{}}}}}},"/api/iiif-wmts/geo-wmts/{slug}/{z}/{x}/{y}/{i}/{j}":{"get":{"tags":["geo-wmts","features"],"summary":"地理座標 WMTS GetFeatureInfo","description":"Web Mercator (z,x,y) と (i,j) から地理座標を計算、inverse affine で画像ピクセル座標に逆変換、該当 annotation を WGS84 GeoJSON で返す。","parameters":[{"$ref":"#/components/parameters/GeoSlugPath"},{"$ref":"#/components/parameters/Z"},{"$ref":"#/components/parameters/X"},{"$ref":"#/components/parameters/Y"},{"$ref":"#/components/parameters/I"},{"$ref":"#/components/parameters/J"},{"name":"format","in":"query","schema":{"type":"string","enum":["geojson","json","html"]},"example":"geojson"}],"responses":{"200":{"description":"GeoJSON or HTML","content":{"application/geo+json":{"schema":{"$ref":"#/components/schemas/GeoFeatureCollection"}},"text/html":{}}}}}},"/api/iiif-wmts/features/geo/{slug}":{"get":{"tags":["features"],"summary":"全 annotation を WGS84 GeoJSON で返却","description":"pixel → mercator → lonlat の forward 変換でアノテーションを WGS84 にプロジェクト。","parameters":[{"$ref":"#/components/parameters/GeoSlugPath"}],"responses":{"200":{"description":"FeatureCollection (WGS84)","content":{"application/geo+json":{"schema":{"$ref":"#/components/schemas/GeoFeatureCollection"}}}}}}},"/api/iiif-wmts/geo-info/{id}":{"get":{"tags":["geo-wmts","meta"],"summary":"GCP から center / bounds を計算 (allmaps.xyz tiles.json 代替)","description":"GCP の min/max lonlat から center と bounds を返す。OpenLayers の初期 View を自前で決めるための情報。","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","enum":["iiif-geo"]},"example":"iiif-geo"}],"responses":{"200":{"description":"GeoInfo","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GeoInfo"}}}}}}},"/api/iiif-wmts/iiif/{path}":{"get":{"tags":["iiif"],"summary":"IIIF reverse proxy (UA注入で CloudFront 等を通過)","description":"info.json レスポンスでは @id / id を本サイトの proxy URL に書き換えて、Allmaps の後続リクエストが proxy を経由するようにする。","parameters":[{"name":"path","in":"path","required":true,"schema":{"type":"string"},"example":"agriculture_re%2Fnou_tatemonochokanzu%2F0002.tif/info.json"}],"responses":{"200":{"description":"IIIF resource"}}}},"/api/iiif-wmts/georef/{slug}":{"get":{"tags":["georef"],"summary":"Manifest から georef annotation を抽出し standalone Annotation で返却","description":"`useReverseProxy: true` のエントリでは target.source.id を本サイトの IIIF reverse-proxy URL に書き換える。allmaps.xyz に `?url=...` で渡すための入力。","parameters":[{"$ref":"#/components/parameters/GeoSlugPath"}],"responses":{"200":{"description":"Georeference Annotation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GeorefAnnotation"}}}}}}}}}