|
| 1 | +# 0. wmts - 教程 |
| 2 | + |
| 3 | +[标准的 WMTS 元数据](http://develop.smaryun.com:6163/igs/rest/ogc/SAMPLETILE/WMTSServer) |
| 4 | + |
| 5 | + |
| 6 | + |
| 7 | +## 1. restful 调用 - 使用受限 |
| 8 | + |
| 9 | +> `restful调用`的核心是将所有的 级别 行列 图层 样式 的参数统一明码的标记在 url 请求中 |
| 10 | +> 使用这种方式 级别 行列号 都一定是`数字型` 这里很关键 , 常见的金字塔模型里面的级别 都`一般是整数表示`。 |
| 11 | +
|
| 12 | +```js |
| 13 | +var tianditu = new Cesium.WebMapTileServiceImageryProvider({ |
| 14 | + url: 'http://t0.tianditu.com/DataServer?T=vec_w&L={TileMatrix}&Y={TileRow}&X={TileCol}&tk=9c157e9585486c02edf817d2ecbc7752', |
| 15 | + maximumLevel: 19, |
| 16 | + credit: new Cesium.Credit('3857') |
| 17 | +}); |
| 18 | +webGlobe.viewer.imageryLayers.addImageryProvider(tianditu); |
| 19 | +``` |
| 20 | + |
| 21 | + |
| 22 | + |
| 23 | +> 这一种是最常见的 WMTS 加载方式, 但这种方式一般只能处理全球裁瓦片的方式: 如经纬度 EPSG:4326/4490/4610 或者墨卡托 EPSG:3857 |
| 24 | +
|
| 25 | +## 2. kvp - 推荐使用 |
| 26 | + |
| 27 | +> restful 调用 一般处理数值型的 全球金字塔瓦片, kvp 一般处理高斯 或者 局部裁剪的金字塔瓦片 |
| 28 | +
|
| 29 | +### 2.1 kvp 参数说明 |
| 30 | + |
| 31 | +| 参数 | 类型 | OGC-名称 | 图片说明 | |
| 32 | +| :------------------- | :------------ | :------------------------ | :------------------------------------------------------------------- | |
| 33 | +| layer | 字符串 | Layer |  | |
| 34 | +| style | 字符串 | Style |  | |
| 35 | +| format | 字符串 | Format |  | |
| 36 | +| tileMatrixLabels | Array<字符串> | ArrayM<TileMatrix 的名称> |  | |
| 37 | +| layertileMatrixSetID | 字符串 | TileMatrixSet |  | |
| 38 | + |
| 39 | +> 用通俗的话说 |
| 40 | +> |
| 41 | +> 1. `TileMatrix`对应瓦片的某一级 |
| 42 | +> 1. `TileMatrixSet` 对应多个级别合并成的金字塔集合, |
| 43 | +> 1. `TileMatrixLabels` 对应各个级别的称呼(一般是整数,特定情况是`字符串型`) |
| 44 | +> 1. `layertileMatrixSetID` 对应整个金字塔的模型的名称 |
| 45 | +
|
| 46 | +`tileMatrixLabels` 一般 restful 的金字塔级别都是数值型。 但是一些特定的投影方式或者坐标处理方式无法采取对应的整数级别来表示,需要一长串的字符型来具体表达对应的数据细节,因此这个地方就是来替代原来的整数级别。 |
| 47 | + |
| 48 | +如传统的 [0 , 1, 2, 3 , 4] 替换成 ['EPSG:2379_SAMPLETILE_dpi96_GB:11', EPSG:2379_SAMPLETILE_dpi96_GB:12', 'EPSG:2379_SAMPLETILE_dpi96_GB:13', 'EPSG:2379_SAMPLETILE_dpi96_GB:14'] |
| 49 | + |
| 50 | +上面的 EPSG:2379_SAMPLETILE_dpi96_GB:11 的名字命名不重要,关键的是对应的自定义裁图的方式,如果此处是 EPSG:3857_SAMPLETILE_dpi96_GB:0 几乎等效于 墨卡托的 0 级。 |
| 51 | + |
| 52 | +### 2.2 kvp 举例说明 |
| 53 | + |
| 54 | +原始数据是高斯投影的 ,其元数据信息如下: |
| 55 | + |
| 56 | + |
| 57 | +对应的 wmts 的描述如下: |
| 58 | + |
| 59 | + |
| 60 | +```js |
| 61 | +var lnglat = new Cesium.WebMapTileServiceImageryProvider({ |
| 62 | + url: 'http://develop.smaryun.com:6163/igs/rest/ogc/SAMPLETILE/WMTSServer', |
| 63 | + layer: 'SAMPLETILE', |
| 64 | + style: 'default', |
| 65 | + format: 'image/png', |
| 66 | + tilingScheme: new Cesium.WebMercatorTilingScheme(), |
| 67 | + tileMatrixLabels: [ |
| 68 | + 'EPSG:2379_SAMPLETILE_dpi96_GB:11', |
| 69 | + 'EPSG:2379_SAMPLETILE_dpi96_GB:12', |
| 70 | + 'EPSG:2379_SAMPLETILE_dpi96_GB:13', |
| 71 | + 'EPSG:2379_SAMPLETILE_dpi96_GB:14', |
| 72 | + 'EPSG:2379_SAMPLETILE_dpi96_GB:15', |
| 73 | + 'EPSG:2379_SAMPLETILE_dpi96_GB:16', |
| 74 | + 'EPSG:2379_SAMPLETILE_dpi96_GB:17' |
| 75 | + ], |
| 76 | + tileMatrixSetID: 'GoogleMapsCompatible_GB', |
| 77 | + maximumLevel: 19, |
| 78 | + credit: new Cesium.Credit('3857') |
| 79 | +}); |
| 80 | +``` |
| 81 | + |
| 82 | +结果如下: |
| 83 | + |
| 84 | + |
| 85 | +## 3. WMTS 元数据信息不可信!! |
| 86 | + |
| 87 | +与其说 WMTS 元数据信息不可信,本质上是说实际线下实操人员的操作不可信。以上面为例 |
| 88 | + |
| 89 | +> 原始数据明明只有 1 种 高斯的处理方式 |
| 90 | +>  |
| 91 | +> 但是元数据信息描述里面的矩阵集居然有 2 类,其中一类是全球墨卡托, Orz.... |
| 92 | +>  |
| 93 | +
|
| 94 | +### 3.1 出现过该场景的情况 |
| 95 | + |
| 96 | +> 从下面数据情况几乎可以得出结论,无法避免不同平台不同版本带来的差异, `强烈推荐`使用`KVP`的方式`手动匹配`来统一处理,而不是自动解析 WMTS.xml 的元数据信息 |
| 97 | +
|
| 98 | +1. MapGIS 平台官方测试数据 [MapGIS 10.3 & OGC 1.0.0](http://develop.smaryun.com:6163/igs/rest/ogc/SAMPLETILE/WMTSServer) |
| 99 | +1. MapGIS 九州官方测试数据 [MapGIS 10.5 & OGC 1.0.0]() |
| 100 | +1. ArcGIS 官方测试数据 [ArcServer 10.8 & OGC 1.0.0](https://gibs.earthdata.nasa.gov/wmts/epsg4326/best/1.0.0/WMTSCapabilities.xml) |
| 101 | +1. ArcGIS 官方测试数据 [ArcServer 10.7 OGC 1.0.0](http://219.142.81.85/arcgis/rest/services/10wanZH/MapServer/WMTS/1.0.0/WMTSCapabilities.xml) |
| 102 | +1. 西安测绘总站 ArcMap 10.2 & OGC 1.0.0 |
| 103 | +1. 北京发改委 ArcMap 10.5 & OGC 1.0.0 |
| 104 | +1. 深圳信息中心 ArcMap 10.6 & OGC 1.3.0 |
| 105 | +1. 深圳工程中心 ArcMap 10.6 & OGC 1.3.0 |
| 106 | +1. 深圳规划中心 ArcMap 10.6 & OGC 1.3.0 |
| 107 | +1. 地矿云南项目 MapGIS 10.3 & OGC 1.0.0 |
0 commit comments