我正在尝试使用 OpenLayers 查看 WMS 图层,但没有显示任何内容。控制台中不显示任何错误消息。此外,当我尝试使用浏览器 (Firefox) 访问请求字符串时,地图显示得很好。这是代码。
<html>
<head><title>OpenLayers WMS test</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<script src="http://openlayers.org/api/OpenLayers.js"></script>
<script>
function init() {
var map = new OpenLayers.Map("maparea");
var wms = new OpenLayers.Layer.WMS("Maakuntakaava", "http://kartat.lounaispaikka.fi/wms/maakuntakaava",
{'format':'png', 'layers':'mk_tiet', width:600, height:600,
bbox:'224609.4426922916318290,6702129.8832325218245387,265885.8128110636025667,6720672.7353315912187099'},
{ projection: new OpenLayers.Projection("EPSG:3067"),
units: "m",
maxResolution: 1000,
maxExtent: new OpenLayers.Bounds(224609.4426922916318290,6702129.8832325218245387,265885.8128110636025667,6720672.7353315912187099)});
map.addLayer(wms);
alert("Request string: " + wms.getFullRequestString());
}
</script>
</head>
<body onload="init()">
<h1>WMS test</h1>
<div id="maparea"></div>
</body>
</html>
谁能告诉我的代码有什么问题?