【发布时间】:2017-05-01 10:29:09
【问题描述】:
我正在使用 Openlayer3 通过 MapServer WMS 添加栅格图层。 加载页面时,WMS URL 中的 CRS 值更改为 3857。
工作地图服务器网址
http://localhost/cgi-bin/mapserv.exe?map=D:\ mapserver \ amamicimage.map&service = wms&serview = 1.3.0&request = getmap&layers = gujarat&layers = gujarat&styles =&crs = epsg:32643和bbox = 361600.51891405135,240436487.012413664927395和宽度= 800&Height = 500&Format = 500&Format = Image / PNG P>
openlayer 正在请求下面的 URL
解码为
http://localhost/cgi-bin/mapserv.exe?map=D:\地图服务器\ actualimage.map&SERVICE = WMS&VERSION = 1.3.0&REQUEST =的GetMap&FORMAT =图像/ PNG&TRANSPARENT =真LAYERS =古吉拉特&CRS = EPSG:3857&BBOX = 360378.8955393417,2402933.1780538466,367708.6357875995,2410262.918302105&WIDTH = 1&HEIGHT = 1&STYLES = P >
下面是 Openlayer 代码
var layers = [
new ol.layer.Image({
extent: [361600.51891405135,2404154.8014285564,366487.01241288986,2409041.294927395],
source: new ol.source.ImageWMS({
url: encodeURI('http://localhost/cgi-bin/mapserv.exe?map=D:\\mapserver\\actualimage.map'),
params: {
'LAYERS': 'Gujarat',
'CRS': 'EPSG:32643',
'BBOX': '361600.51891405135,2404154.8014285564,366487.01241288986,2409041.294927395',
'WIDTH': '800',
'HEIGHT': '500',
'FORMAT': 'image/png'
},
serverType: 'mapserver',
projection: ol.proj.get('EPSG:32643'),
})
})
];
var map = new ol.Map({
layers: layers,
target: 'map',
view: new ol.View({
center: [361600.51891405135, 2404154.8014285564],
zoom: 1
})
});
【问题讨论】: