Reputation: 45
I am using open layers2
here is my code
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title>webgis</title>
<script type="text/javascript" src="OpenLayers.js"></script>
<style>
div {
height: 641px;
}
</style>
</head>
<body>
<div id="map" style="">
<script type="text/javascript">
map = new OpenLayers.Map("map",{projection:new OpenLayers.Projection("EPSG:900913")})
osmLayer=new OpenLayers.Layer.OSM("OSM")
map.addLayer(osmLayer)
map.setCenter([0,0],1)
controls=[new OpenLayers.Control.OverviewMap(),
new OpenLayers.Control.MousePosition(),
new OpenLayers.Control.LayerSwitcher()]
map.addControls(controls)
wms=new OpenLayers.Layer.WMS("iran",
"http://localhost:8080/geoserver/wms/",
{LAYERS:'python:iran_location'},
{isBaseLayer:false});
map.addLayer(wms)
</script>
</div>
</body>
</html>
so when i open my browser
it first show openstreetmap
and it disappear in seconds and just show one layer
Upvotes: 0
Views: 127
Reputation: 17962
If you want to see the base layer below the top layer the top layer will need some opacity, and you can also try to make the white background of the WMS transparent, for example
wms = new OpenLayers.Layer.WMS("iran",
"http://localhost:8080/geoserver/wms/",
{LAYERS:'python:iran_location', transparent: true},
{opacity: 0.5, isBaseLayer:false});
Upvotes: 1