0
我嘗試將WMS加載到我的地圖,像這樣:的OpenLayers WMS問題
<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("TIRIS", "https://gis.tirol.gv.at/arcgis/services/Service_Public/oph05_wms/MapServer/WMSServer",
{format: 'image/jpeg',
bbox: '10.07,46,13.03,47.735',
layers: 'Orthophoto_Tirol_05m',
width: 256,
height: 256},
{projection: new OpenLayers.Projection("EPSG:4326"),
units: "m",
maxExtent: new OpenLayers.Bounds(10.07,46,13.03,47.735)});
map.addLayer(wms);
map.zoomToMaxExtent();
alert("Request string: " + wms.getFullRequestString());
}
</script>
</head>
<body onload="init()">
<h1>WMS Test</h1>
<div id="maparea"></div>
</body>
</html>
我得到的鉻控制檯沒有錯誤,因此不知道從哪裏何去何從.. 如果我提前http://gimoya.bplaced.net/WMS_test.html
感謝任何指針:打開從網絡選項卡中的鏈接(如:https://gis.tirol.gv.at/arcgis/services/Service_Public/oph05_wms/MapServer/WMSServer?FORMAT=image%2Fjpeg&BBOX=11.55578125,46.864296875,11.558671875,46.8671875&LAYERS=Orthophoto_Tirol_05m&WIDTH=256&HEIGHT=256&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&SRS=EPSG%3A4326)我得到了一個空白頁面..
這裏是一個活生生的例子!
工作的例子是用戶名和密碼保護,這使得它很難調試。如果你可以通過網絡標籤抓取一個工作的wms網址,這將有所幫助(假設你被允許)。 – 2014-10-01 08:37:41
@JohnBarça,對不起,我把html放到了我ftp上的可訪問目錄中!對於你的第二個問題:我認爲我從網絡標籤發佈的是你要求的,不是嗎? – Kay 2014-10-02 06:39:10
通常情況下,您不會在OpenLayers.Layer.WMS中配置BBOX,寬度和高度等內容。最小值是圖層名稱,URL和「圖層」(通常)。看到這裏:view-source:http://dev.openlayers.org/examples/lite.html。 – lexicore 2014-11-03 16:12:14