[OpenLayers-Dev] Why I cant open WMS layer?

Malik Shahzad malik.rsgis at gmail.com
Thu Oct 28 13:18:28 EDT 2010


Dear I am new to Open layers and need some information.

I am trying to add some WMS layers but failed to do :( I am following one
tutorial and write following code.


<html>
<head>
<title>OpenLayers Example</title>
<script src="http://openlayers.org/api/OpenLayers.js"></script>
<script defer="defer" type="text/javascript">
function init()
{
var map = new OpenLayers.Map('map');
var wms = new OpenLayers.Layer .WMS( "OpenLayers WMS",
"http://labs.metacarta.com/wms/vmap0",
{layers: 'basic'}
);
map.addLayer (wms);
map.zoomToMaxExtent();

var lon = 100.4;
var lat = 13.1;
var zoom = 5;
map.setCenter(new OpenLayers.LonLat(lon, lat), zoom);


map.addControl( new OpenLayers.Control.LayerSwitcher() );

var jpl_wms = new OpenLayers.Layer.WMS( "NASA Global Mosaic",
"http://t1.hypercube.telascience.org/cgi-bin/landsat7" ,
{layers: "landsat7"}
);
map.addLayer(jpl_wms);
}

</script>
</head>

<body onload=init()>

<div style="width: 800px; height: 475px" id="map">

Hello My Map

</div>
</body>
</html>




waiting for your kind response.
Malik
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-dev/attachments/20101029/3ec38d7b/attachment.html


More information about the Dev mailing list