结合wmts和wms

时间:2015-12-10 09:50:23

标签: openlayers openlayers-3 wms

我想将WMS与WMTS结合起来。我和OL一起工作 3.10.1。单独或仅组合WMS,应用程序中的服务没有问题。只有WMTS服务才能在我的OL3-Application中正常工作。

但是当我向WMTS OL3添加WMS生成带&SRS=EPSG%3A3857&的WMS-GetMap-Requests时,尽管我的所有服务都基于EPSG 25832(WMTS也是如此)。 WMS-Response包含ServiceException代码InvalidSRS。当我复制wms-getmap-request并将3857替换为25832时,响应是一个正确的映射。

在我的OL3-Application中,我还使用投影对象测试但没有成功。



var layer_wmts=new ol.layer.Tile({
		source: new ol.source.WMTS({
			url: 'https://sg.geodatenzentrum.de/xxxx',
			layer:'xxx',
			matrixSet:'DE_EPSG_25832_ADV',
			tileGrid: tileGrid,
			format: 'image/png',
			style: 'normal',
			projection: 'EPSG:25832'
			})
		});
		
var layer_grenzen=new ol.layer.Image({
	source: new ol.source.ImageWMS({
	url:'http://intra-entumn1.vkv.niedersachsen.de/fcgi-bin/ows/verwaltungsgrenzen',
	params: {'LAYERS': 'AG',VERSION: '1.1.1',defaultProjection:'EPSG:25832',projection:'EPSG:25832'}
    })
 });	
	
var map = new ol.Map({
  layers: [layer_wmts,layer_grenzen],
  target: 'map',
  view: new ol.View({center:[594560.,5806642.],zoom:8,minZoom:7,maxZoom:18}),
  controls: ol.control.defaults().extend([new ol.control.ScaleLine(),new ol.control.MousePosition({coordinateFormat: ol.coordinate.createStringXY(0)})
  ]),
});




如何在OL3中组合WMTS和WMS?

1 个答案:

答案 0 :(得分:0)

当使用wmts和wms(默认投影为3857)时,

使用投影对象运行。

var projection = new ol.proj.Projection({
  code: 'EPSG:25832',
  extent: [ -1878007.03, 3932282.86, 831544.53, 9437501.55]
});

// …

var view = new ol.View({
  projection: projection
  // …
});