使用的是10i
我加载了http://localhost:8090/iserver/services/map-china400/wmts-china(安装好自带得那个)
iserver得这个瓦片貌似偏了,我在下面叠了高德得瓦片是ok得
我不太懂这个瓦片得规则,麻烦问问这个怎么搞
下面是我加载得代码(最近问题有点多呀)
var resolutions = new Array(17);
var matrixIds = new Array(17);
for (var z = 0; z < 17; ++z) {
resolutions[z] = 156543.033928041 / Math.pow(2, z);
matrixIds[z] = z;
}
var projectionExtent = ol.proj.get('EPSG:3857').getExtent()
var map = new ol.Map({
target: 'map',
view: new ol.View({
// projection: 'EPSG:4326',//投影类别
// center: ([120, 30]),
center: ol.proj.transform([120, 30], 'EPSG:4326', 'EPSG:3857'),
zoom: 12,
// multiWorld: true
}),
layers: [
new ol.layer.Tile({
title: 'gaode',
source: new ol.source.XYZ({
url: 'http://wprd0{1-4}.is.autonavi.com/appmaptile?lang=zh_cn&size=1&style=7&x={x}&y={y}&z={z}'
})
}),
new ol.layer.Tile({
opacity: 0.9,
source: new ol.source.WMTS({
url: "http://localhost:8090/iserver/services/map-china400/wmts-china",
layer: 'China',
matrixSet: 'ChinaPublicServices_China',
format: 'image/png',
// projection: 'EPSG:4326', //数据的投影坐标系
tileGrid: new ol.tilegrid.WMTS({
origin: ol.extent.getTopLeft(projectionExtent),
// extent: [-180.0, -85.05112877980652, 180.0, 85.05112877980646],
resolutions: resolutions,
matrixIds: matrixIds
}),
style: 'default',
attributions: "Map Data <span>© <a href='http://support.supermap.com.cn/product/iServer.aspx' target='_blank'>SuperMap iServer</a></span> with <span>© <a href='http://iclient.supermap.io' target='_blank'>SuperMap iClient</a></span>"
})
}),
]
});