OpenLayersのWMTSレイヤー
2013年11月28日
GeoServerのGeoWebCacheの場合
var matrixIds = new Array(21); for (var i=0; i<21; ++i) { matrixIds[i] = "EPSG:900913:" + i; } var area2_all = new OpenLayers.Layer.WMTS({ name: "area2_all wmts", url: "/geoserver/gwc/service/wmts/", layer: "zmaparea2:area2_all", matrixSet: "EPSG:900913", matrixIds: matrixIds, format: "image/png", style: null, opacity: 0.7, isBaseLayer: false ,tileSize: new OpenLayers.Size(256,256) ,maxExtent: mapBounds ,minResolution: maxResolution / ( 1 << (30) ) ,maxResolution: maxResolution / ( 1 << (0) ) }); _map.addLayer(area2_all);
テンプレートで指定する場合
例:日本シームレス地質図
for (var i=0; i<21; ++i) { matrixIds[i] = "" + i; } var seamless = new OpenLayers.Layer.WMTS({ name: "日本シームレス地質図", url: "https://gbank.gsj.jp/seamless/tilemap/{TileMatrixSet}/{style}/{TileMatrix}/{TileRow}/{TileCol}.png", layer: "detailed", requestEncoding: "REST", version: "1.0.0", style: "glfn", matrixSet: "detailed", matrixIds: matrixIds, format: "image/png", style: "glfn", opacity: 0.7, isBaseLayer: false ,tileSize: new OpenLayers.Size(256,256) ,maxExtent: mapBounds ,minResolution: maxResolution / ( 1 << (18) ) ,maxResolution: maxResolution / ( 1 << (0) ) }); _map.addLayer(seamless); seamless.setVisibility( false );