[mapserver-users] Hellp please!!
Özgür Arslan
ozgurarslan81 at hotmail.com
Sun Apr 8 21:14:28 PDT 2012
HI All,
I am working on open layers and map file and I have a question. I am
trying to create several layers from 1 map file on open layers, and I
want to switch off and on but I couldn't separate the layers in
OpenLayers. When I set layers to DEFAULT in map file it displays all
layers together like a one layer. I can't create different layers from
one map file. Are there any ideas? Codes are below;
Thank you
<html>
<head>
<title>OpenLayers Example</title>
<link rel="stylesheet" href="openlayers/theme/default/style.css" type="text/css">
<script src="http://openlayers.org/api/OpenLayers.js"></script>
</head>
<body>
<center><div id="map"></div></center>
<style>
@media screen
{
#map{width:975px; height:750px; border: 2px solid black;}
}
</style>
<script defer="defer" type="text/javascript">
var lon = -84.722147;
var lat = 49.298594;
var zoom = 6;
var map, layer;
var map = new OpenLayers.Map('map');
layer = new OpenLayers.Layer.WMS( "QGIS-MAP",
"http://localhost/cgi-bin/mapserv.exe", {layers: 'ResidentDistrict_2011,LAKES,MDI_2011',map: '/wwwroot/example1_test/Canada_Mountains.map',} )
map.addLayer(layer);
map.zoomToMaxExtent();
map.setCenter(new OpenLayers.LonLat(lon, lat), zoom);
map.addControl(new OpenLayers.Control.PanZoomBar());
map.addControl(new OpenLayers.Control.MouseToolbar());
map.addControl(new OpenLayers.Control.LayerSwitcher());
map.addControl(new OpenLayers.Control.MousePosition());
map.addControl(new OpenLayers.Control.OverviewMap());
</script>
</body>
</html>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20120409/a122f6ea/attachment.htm>
More information about the MapServer-users
mailing list