首页 / 浏览问题 / 云GIS / 问题详情
Javascript WMTS
14EXP 2017年04月25日
<TileMatrixSet>
<ows:Identifier>CQMap_VEC</ows:Identifier>
<ows:SupportedCRS>urn:ogc:def:crs:EPSG::4490</ows:SupportedCRS>

<TileMatrix><ows:Identifier>1</ows:Identifier><ScaleDenominator>2.9582935545456576E8</ScaleDenominator><TileWidth>256</TileWidth><TileHeight>256</TileHeight><MatrixWidth>2</MatrixWidth><MatrixHeight>1</MatrixHeight><TopLeftCorner>90.0 -180.0</TopLeftCorner></TileMatrix><TileMatrix><ows:Identifier>2</ows:Identifier><ScaleDenominator>1.4791467772728288E8</ScaleDenominator><TileWidth>256</TileWidth><TileHeight>256</TileHeight><MatrixWidth>4</MatrixWidth><MatrixHeight>2</MatrixHeight><TopLeftCorner>90.0 -180.0</TopLeftCorner></TileMatrix><TileMatrix><ows:Identifier>3</ows:Identifier><ScaleDenominator>7.395733886364144E7</ScaleDenominator><TileWidth>256</TileWidth><TileHeight>256</TileHeight><MatrixWidth>8</MatrixWidth><MatrixHeight>4</MatrixHeight><TopLeftCorner>90.0 -180.0</TopLeftCorner></TileMatrix><TileMatrix><ows:Identifier>4</ows:Identifier><ScaleDenominator>3.697866943182072E7</ScaleDenominator><TileWidth>256</TileWidth><TileHeight>256</TileHeight><MatrixWidth>16</MatrixWidth><MatrixHeight>8</MatrixHeight><TopLeftCorner>90.0 -180.0</TopLeftCorner></TileMatrix><TileMatrix><ows:Identifier>5</ows:Identifier><ScaleDenominator>1.848933471591036E7</ScaleDenominator><TileWidth>256</TileWidth><TileHeight>256</TileHeight><MatrixWidth>32</MatrixWidth><MatrixHeight>16</MatrixHeight><TopLeftCorner>90.0 -180.0</TopLeftCorner></TileMatrix><TileMatrix><ows:Identifier>6</ows:Identifier><ScaleDenominator>9244667.35795518</ScaleDenominator><TileWidth>256</TileWidth><TileHeight>256</TileHeight><MatrixWidth>64</MatrixWidth><MatrixHeight>32</MatrixHeight><TopLeftCorner>90.0 -180.0</TopLeftCorner></TileMatrix><TileMatrix><ows:Identifier>7</ows:Identifier><ScaleDenominator>4622333.67897759</ScaleDenominator><TileWidth>256</TileWidth><TileHeight>256</TileHeight><MatrixWidth>128</MatrixWidth><MatrixHeight>64</MatrixHeight><TopLeftCorner>90.0 -180.0</TopLeftCorner></TileMatrix><TileMatrix><ows:Identifier>8</ows:Identifier><ScaleDenominator>2311166.839488795</ScaleDenominator><TileWidth>256</TileWidth><TileHeight>256</TileHeight><MatrixWidth>256</MatrixWidth><MatrixHeight>128</MatrixHeight><TopLeftCorner>90.0 -180.0</TopLeftCorner></TileMatrix><TileMatrix><ows:Identifier>9</ows:Identifier><ScaleDenominator>1155583.4197443975</ScaleDenominator><TileWidth>256</TileWidth><TileHeight>256</TileHeight><MatrixWidth>512</MatrixWidth><MatrixHeight>256</MatrixHeight><TopLeftCorner>90.0 -180.0</TopLeftCorner></TileMatrix><TileMatrix><ows:Identifier>10</ows:Identifier><ScaleDenominator>577791.7098721988</ScaleDenominator><TileWidth>256</TileWidth><TileHeight>256</TileHeight><MatrixWidth>1024</MatrixWidth><MatrixHeight>512</MatrixHeight><TopLeftCorner>90.0 -180.0</TopLeftCorner></TileMatrix><TileMatrix><ows:Identifier>11</ows:Identifier><ScaleDenominator>288895.8549360994</ScaleDenominator><TileWidth>256</TileWidth><TileHeight>256</TileHeight><MatrixWidth>2048</MatrixWidth><MatrixHeight>1024</MatrixHeight><TopLeftCorner>90.0 -180.0</TopLeftCorner></TileMatrix><TileMatrix><ows:Identifier>12</ows:Identifier><ScaleDenominator>144447.9274680497</ScaleDenominator><TileWidth>256</TileWidth><TileHeight>256</TileHeight><MatrixWidth>4096</MatrixWidth><MatrixHeight>2048</MatrixHeight><TopLeftCorner>90.0 -180.0</TopLeftCorner></TileMatrix><TileMatrix><ows:Identifier>13</ows:Identifier><ScaleDenominator>72223.96373402484</ScaleDenominator><TileWidth>256</TileWidth><TileHeight>256</TileHeight><MatrixWidth>8192</MatrixWidth><MatrixHeight>4096</MatrixHeight><TopLeftCorner>90.0 -180.0</TopLeftCorner></TileMatrix><TileMatrix><ows:Identifier>14</ows:Identifier><ScaleDenominator>36111.98186701242</ScaleDenominator><TileWidth>256</TileWidth><TileHeight>256</TileHeight><MatrixWidth>16384</MatrixWidth><MatrixHeight>8192</MatrixHeight><TopLeftCorner>90.0 -180.0</TopLeftCorner></TileMatrix><TileMatrix><ows:Identifier>15</ows:Identifier><ScaleDenominator>18055.99093350621</ScaleDenominator><TileWidth>256</TileWidth><TileHeight>256</TileHeight><MatrixWidth>32768</MatrixWidth><MatrixHeight>16384</MatrixHeight><TopLeftCorner>90.0 -180.0</TopLeftCorner></TileMatrix><TileMatrix><ows:Identifier>16</ows:Identifier><ScaleDenominator>9027.995466753106</ScaleDenominator><TileWidth>256</TileWidth><TileHeight>256</TileHeight><MatrixWidth>65536</MatrixWidth><MatrixHeight>32768</MatrixHeight><TopLeftCorner>90.0 -180.0</TopLeftCorner></TileMatrix><TileMatrix><ows:Identifier>17</ows:Identifier><ScaleDenominator>4513.997733376553</ScaleDenominator><TileWidth>256</TileWidth><TileHeight>256</TileHeight><MatrixWidth>131072</MatrixWidth><MatrixHeight>65536</MatrixHeight><TopLeftCorner>90.0 -180.0</TopLeftCorner></TileMatrix><TileMatrix><ows:Identifier>18</ows:Identifier><ScaleDenominator>2256.9988666882764</ScaleDenominator><TileWidth>256</TileWidth><TileHeight>256</TileHeight><MatrixWidth>262144</MatrixWidth><MatrixHeight>131072</MatrixHeight><TopLeftCorner>90.0 -180.0</TopLeftCorner></TileMatrix></TileMatrixSet>
</Contents>

如上面的WMTS的配置文件,我只想显示9-18级,应该怎么写呢?zoomOffset不好使..

3 个回答

您好,您可以在实例化地图时设置最大和最小缩放级别maxZoom和minZoom已达到您的需求:

1,695EXP 2017年04月25日
哎。。8.1才有呢- -
而且..我想要的效果是..让缩放控件的最底部,也就是最小值不是从0开始,而是从第9级开始..
您也可以通过设定最大与最小比例尺属性maxScale和minScale的方法来,wmts的<ScaleDenominator>表示的就是对应层级所对应的比例尺。当您设定了最大与最小比例尺后,您的地图缩放空间也会随之变化最大与最小级别的。
不行哦..minScale minResolution minZoom...都试过了...设置了后,切片的row和col不对了

您好!如果只想显示9-18级,客户端对接的时候  resolutions 数组里面只添加9-18级的就可以了!

663EXP 2017年04月25日
var matrixIds = [];
    for (var i=0; i<10; i++) {
        matrixIds[i] = {identifier:(i+9)};
    };
    //当前图层的分辨率数组信息,和matrixIds一样,需要用户从wmts服务获取并明确设置,resolutions数组和matrixIds数组长度相同
    var resolutions = [
                                            // 2.9582935545456576E8,1.4791467772728288E8,7.395733886364144E7,
                                            // 3.697866943182072E7,1.848933471591036E7,9244667.35795518,
                                            // 4622333.67897759,2311166.839488795,

                                1155583.4197443975,
                       577791.7098721988,288895.8549360994,144447.9274680497,
                       72223.96373402484,36111.98186701242,18055.99093350621,
                       9027.995466753106,4513.997733376553,2256.9988666882764];
    //新建图层
    var url="http://xx.xx.xx.xx:8081/geoesb/proxy/d9dedf3b39b34fb0b5b3b4cb2855d0f2/f69b96a249cb42f59532abc1e53668ba";
    baseLayerSl = new SuperMap.Layer.WMTS({name: "CQMap_VEC",
        url: url,
        layer: "CQMap_VEC",
        style: "default",
        matrixSet: "CQMap_VEC",
        // matrixIds:matrixIds,
        // resolutions:resolutions,
        // tileFullExtent:new SuperMap.Bounds(104.988424239, 28.098457895, 108.973788561, 30.686177091),
        //tileOrigin:new SuperMap.LonLat(-180.0, 90.0),
        //zoomOffset:-1,
        format: "image/png",
        opacity: 1,
        requestEncoding:"KVP"});
    map.addLayers([baseLayerSl]);

我是这样写的。。显示不出来..

我按照你的方式写是可以的呀,你是不是因为把下面注释掉了

我搞错了。把比例尺写成resolutions了
您好,刚刚给您写了一个示范代码,不知是否满足您的要求;注明:仅供参考

链接:http://pan.baidu.com/s/1jHRi2FG 密码:vs16

有问题可以通过我的邮箱联系我一起探讨
94EXP 2017年04月25日
...