前言
有网友在群里说天地图山东的山东省线划电子地图暗色版服务加载不成功,抱着好奇及帮助别人的心态去试了下,结果可以,并记录下。
实现过程
查看服务元数据访问http://124.128.48.215:8083/tileservice/dsfg_asdxb?request=GetCapabilities&Service=WMTS查看关键参数
代码
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8" /><meta name="viewport" content="width=device-width, initial-scale=1" /><meta name="theme-color" content="#000000" /><link href="../../Cesium/Widgets/widgets.css" rel="stylesheet"><script type="text/javascript" src="../../Cesium/Cesium.js"></script><title>山东天地图wmts服务</title></head><body style="margin: 0px;width:100%;height:100%;"><div id="cesiumContainer" style="width:100%;height:100%;position:absolute;"></div></body><script>//created by onegiser at -11-08const tileMatrixLabels = []for (let i = 1; i <= 20; ++i) {tileMatrixLabels.push(i)}const viewer = new Cesium.Viewer('cesiumContainer', {imageryProvider: new Cesium.WebMapTileServiceImageryProvider({url: "http://124.128.48.215:8083/tileservice/dsfg_asdxb",layer: "BigdataBg",style: 'default',format: 'image/jpeg',tileMatrixSetID: 'BigdataSdmapBlack',tileMatrixLabels,tilingScheme: new Cesium.GeographicTilingScheme(),})})viewer.camera.flyTo({destination: Cesium.Rectangle.fromDegrees(114.229839088925, 33.9389305555556, 123.400530149205, 38.9048194444444),})</script></html>