diff --git a/backend/src/routes/tiles.ts b/backend/src/routes/tiles.ts index 0494823..a0ba100 100644 --- a/backend/src/routes/tiles.ts +++ b/backend/src/routes/tiles.ts @@ -54,6 +54,28 @@ router.get('/vworld/:z/:y/:x', async (req, res) => { await proxyUpstream(tileUrl, res, 'image/jpeg'); }); +// ─── SR 민감자원 벡터타일 ─── + +// GET /api/tiles/sr/tilejson — SR TileJSON 프록시 (source-layer 메타데이터) +router.get('/sr/tilejson', async (_req, res) => { + await proxyUpstream(`${ENC_UPSTREAM}/sr`, res, 'application/json'); +}); + +// GET /api/tiles/sr/style — SR 스타일 JSON 프록시 (레이어별 type/paint/layout 정의) +router.get('/sr/style', async (_req, res) => { + await proxyUpstream(`${ENC_UPSTREAM}/style/sr`, res, 'application/json'); +}); + +// GET /api/tiles/sr/:z/:x/:y — SR(민감자원) 벡터타일 프록시 +router.get('/sr/:z/:x/:y', async (req, res) => { + const { z, x, y } = req.params; + if (!/^\d+$/.test(z) || !/^\d+$/.test(x) || !/^\d+$/.test(y)) { + res.status(400).json({ error: '잘못된 타일 좌표' }); + return; + } + await proxyUpstream(`${ENC_UPSTREAM}/sr/${z}/${x}/${y}`, res, 'application/x-protobuf'); +}); + // ─── S-57 전자해도 (ENC) ─── // tiles.gcnautical.com CORS 제한 우회를 위한 프록시 엔드포인트 그룹