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