我试图用OL3呈现一个地图服务器,它不能正常工作。地图服务器的文档不存在,并且地图服务器的GetCapabilities以非常短(不太好或有用)的答案作出响应。
我已设法展示地图,但它看起来非常奇怪,非常像。一张图片说的话超过了千言万语,所以我只会告诉你它的外观。
http://imgur.com/UUVJEVK http://imgur.com/lkSk3H4 http://imgur.com/mlNbHF0
我甚至做了一个JS小提琴:
var oLayers = "ST:background";
var oURL = "its on the jsfiddle";
var oProjection = "EPSG:3006";
var oScales = [4000,8000,15000,30000,90000, 120000, 180000, 250000, 500000];
var screenDPI = 95;
var IPM = 39.37;
var resolutions = [];
for (var i = oScales.length-1; i >= 0;--i) {
resolutions.push(oScales[i] / (screenDPI * IPM));
}
var extent=[181896.33,6101648.07,864582.51,7688373.92];
var projection = new ol.proj.Projection({
code: oProjection,
units: "m",
extent: extent
});
//ol.proj.addProjection(projection);
var layers = [
new ol.layer.Tile({
extent: extent,
source: new ol.source.TileWMS({
url: oURL,
params: {'LAYERS':oLayers,
'SRS' : "EPSG:3006"}
})
})
];
var view = new ol.View({
projection: projection,
center: ol.proj.transform([13.0, 55.6], 'EPSG:4326', oProjection),
resolutions: resolutions,
extent: extent,
zoom: 0
});
var map = new ol.Map({
layers: layers,
target: 'maps',
view: view
});
有什么想法吗?
答案 0 :(得分:1)
WMS GetMap
网址看起来不错:
http://gis.skanetrafiken.se/wmspublic/service/wms?
SERVICE=WMS&
VERSION=1.3.0&
REQUEST=GetMap&
FORMAT=image%2Fpng&
TRANSPARENT=true&
LAYERS=ST%3Abackground&
SRS=EPSG%3A3006&
WIDTH=640&
HEIGHT=640&
STYLES=&
BBOX=405029.65265624993%2C6138836.957109375%2C417425.94835937495%2C6151233.2528125
但这就是WMS服务器呈现的内容:
所以我猜问题不是OL而是服务器上的样式配置。或许您可能需要找出合适的缩放级别。使用相同的WMS服务器是否有一个工作和良好的解决方案?检查它们的缩放级别。