Class: WMTS

.Format. WMTS

根据网络地图切片服务url,获取服务信息,解析后得到图层配置参数,构建网络切片地图服务的数据源和图层。 使用此工具前,请先验证服务接口是否正常。

new WMTS()

Source:
View2D/Format/Util/WMTS.js
Example
var layers=null;
var Capabilities=null;
var wmts = new GeoGlobe.Format.WMTS();
layers=wmts.createLayers("http://192.168.100.231:8889/WMTS_Util/wmts");
Capabilities=wmts.getWMTSCapabilities("http://192.168.100.231:8889/WMTS_Util/wmts");

Methods


calculationTopTileExtentAndZoomOffset(capabilitieOptions)

计算顶部图层的范围和zoomOffset值
Parameters:
Name Type Description
capabilitieOptions Object 必填 读取的capabilitie XML文档信息选项
Properties
Name Type Description
identifier Number 必填 顶部图层ID,例如:从<ows:Identifier>0</ows:Identifier>中取0
scaleDenominator Number 必填 顶部图层比例尺分母,例如:从<ScaleDenominator>377976.1904761904</ScaleDenominator>中取377976.1904761904
topLeftCorner Array 必填 顶部图层左上角点坐标(格式为[x,y]),例如:从<TopLeftCorner>-200.0 178200.525</TopLeftCorner>中取-200.0 178200.525,写成[-200.0,178200.525]
tileSize Number 必填 顶部图层每个瓦片大小,例如:从<TileWidth>256</TileWidth>、<TileHeight>256</TileHeight>中取共同值256
matrixWidth Number 必填 顶部图层横向所需瓦片个数,例如:从<MatrixWidth>5</MatrixWidth>中取5
matrixHeight Number 必填 顶部图层纵向所需瓦片个数,例如:从<MatrixHeight>3</MatrixHeight>中取3
inchConvertMeterRatio Number 可选 英寸转米的系数, 默认:0.0254,其它参考值:0.0254000508001016、0.025399998
degreeConvertMeterRatio Number 可选 度转米的系数, 默认:111000
dpi Number 可选 图像每英寸面积内的像素点数, 默认:96,其它参考值:90.714
units String 可选 投影单位, 参考可选值:m、degrees
resolution Number 可选 顶部图层的分辨率,如该项填值,则程序舍弃由比例尺、dpi等参数计算出的分辨率而优先选用该值
Source:
View2D/Format/Util/WMTS.js
Returns:
返回顶部图层的范围、zoomOffset值及推荐的zoom值、中心点坐标(推荐值仅供参考)
Type
Object
Example
var capabilitieOptions={
            identifier:0,
            scaleDenominator:1058271.9496196122,
            topLeftCorner:[1.00021E7,3.38768E7],
            tileSize:256,
            matrixWidth:81,
            matrixHeight:88,
            units:"m",//如果是平面投影,该选项值必填,默认值是degrees
            //inchConvertMeterRatio:0.025399998,
            //degreeConvertMeterRatio:111000,
            //dpi:96,
			//resolution:""
        };
     var wmts = new GeoGlobe.Format.WMTS();
     var result = wmts.calculationTopTileExtentAndZoomOffset(capabilitieOptions);
     //包含source和layer的样式,cartodb地图
     Cfg.style = {
	        "version": 8,
	        "sources": {
	            "arcgis": {
	                "type": "raster",
	                "tiles": [Cfg.proxyHostUrl + "http://61.144.226.44:6080/arcgis/rest/services/basemap/szmap_basemap_201608_01/MapServer/WMTS?SERVICE=WMTS&REQUEST=GetTile&LAYER=basemap_szmap_basemap_201608_01&TILEMATRIXSET=nativeTileMatrixSet&FORMAT=image/png&VERSION=1.0.0&STYLE=default&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}"],
	                "tileSize": 256,
	                //填入zoomOffset值
					"zoomOffset": result.zoomOffset
	            }
	        },
	        "layers": [{
	            "id": "1",
	            "type": "raster",
	            "source": "arcgis"
	        }]
	    };
     var map = new GeoGlobe.Map({
			mapCRS: {
			    //填入topTileExtent值
				topTileExtent:result.topTileExtent,
	            coordtransform:"none",
	            tileSize: 256
	    	},
			units: 'm',
	        style: Cfg.style,
	        container: 'map',
	        //填入推荐的zoom值
	        zoom:result.proposalZoom,
	        //填入推荐的centerPoint值
	        //中心点的计算值只是建议值,建议通过其他方法确定地图的中心点(Arcgis server服务可通过bbox计算,GeoGlobe server服务可通过其他途径)
			center:result.centerPoint,
	        maxTileCacheSize: 0,
			isIntScrollZoom: true,//缩放级别是否为整数处理模式
			renderWorldCopies: false,
	        isAttributionControl: false
	    });

createLayer(url, options)

获取单个图层信息。
Parameters:
Name Type Description
url string 服务的请求串。
options object 放置请求服务的信息
Source:
View2D/Format/Util/WMTS.js

createLayers(url)

获取多个图层信息。
Parameters:
Name Type Description
url string 服务的请求串。
Source:
View2D/Format/Util/WMTS.js

getCapabilities(url, successFn, failFn)

根据网络切片地图的服务地址url获取服务能力信息。
Parameters:
Name Type Description
url String WMTS服务地址
successFn function 成功回调函数
failFn function 失败回调函数
Source:
View2D/Format/Util/WMTS.js

getWMTSCapabilities(url)

获取网络切片地图服务信息的XML文档信息
Parameters:
Name Type Description
url string 网络切片地图的服务地址
Source:
View2D/Format/Util/WMTS.js
Returns:
网络切片地图的服务能力信息
Type
object

initialize()

GeoGlobe.Format.WMTS构造函数。
Source:
View2D/Format/Util/WMTS.js