[OpenLayers-Users] Layerswitcher problem

Arnd Wippermann arnd.wippermann at web.de
Fri Jun 1 11:11:57 PDT 2012


I encountered this behaviour, when I used OpenLayers with style.css from an
older version

Arnd
 

-----Ursprüngliche Nachricht-----
Von: openlayers-users-bounces at lists.osgeo.org
[mailto:openlayers-users-bounces at lists.osgeo.org] Im Auftrag von Alberto
Najera
Gesendet: Freitag, 1. Juni 2012 19:25
An: openlayers-users at lists.osgeo.org
Betreff: [OpenLayers-Users] Layerswitcher problem

Hello

I am having a problem with the layer switcher while using a Google maps
layer. The layer switcher icon is drawn on the upper left side of the map
window, in the same spot as the zoom controls. Why is this so and how can it
be fixed?  This is the code:


<!DOCTYPE html>
<html lang='en'>
<head> 
    <meta charset='utf-8' /> 
    <script type='text/javascript' src="OpenLayers.js"></script>
	<script
src="http://maps.google.com/maps/api/js?sensor=false"></script>	
    <script type='text/javascript'>

    var map;
    
    function init() {
        // Setup our map object
        map = new OpenLayers.Map('map_element', {maxExtent: new
OpenLayers.Bounds( -20037508, -20037508, 20037508, 20037508.34
 ) });
        
		// Add a Google Maps Layer
		var google_map_layer = new OpenLayers.Layer.Google(
			'Google Map Layer',
			{"sphericalMercator": true}
		);

     // override default epsg code
			aliasproj = new OpenLayers.Projection("EPSG:3857");
			google_map_layer.projection = aliasproj;

		// Add the layer
		map.addLayer(google_map_layer);
        
    var layer3 = new OpenLayers.Layer.WMS(
		"Ferreterias",
		"http://mysite/cgi-bin/mapserv?", 
		{map: '/home/mysite/tmp/DemoFerre.map', 
		layers:'ferreterias', transparent: true},
{isBaseLayer:false, displayInLayerSwitcher: true});
        
    // Add the layer
		map.addLayer(layer3);   
		
		        
   // Add a layer switcher control
   map.addControl(new OpenLayers.Control.LayerSwitcher({}));
        
        // Zoom the map to the max extent 
		if(!map.getCenter()){
			//map.zoomToMaxExtent();
			map.zoomToExtent(new OpenLayers.Bounds( -11084205,
2011108, -10758597, 2383232))
		}
			
    }

    </script>
	<style type="text/css">
.style1 {
	font-family: Calibri;
	font-size: medium;
}
</style>
</head>

<body onload='init();'>

<span lang="es"><span class="style1"> SECTOR FERRETERO EN
PUEBLA</span></span><div id='map_element' style='width: 500px; height:
500px;'>
		</div>
</body>
</html>

Thanks

Alberto Najera


_______________________________________________
Users mailing list
Users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/openlayers-users



More information about the Users mailing list