[mapserver-users] Open Layers Problem

Alberto Najera anajera at bicimapas.com.mx
Sun Apr 29 14:04:01 EDT 2012


Arnd,

Thanks for the test and the link showing one of our test map WMS layers. I
good to know it is working now after fixing the map  file path. I have been
trying to get the map image in OpenLayers but cannot yet make it show. As
you, I think that the issue now is that the sample is very small and scale
settings shall be used. This is what I have put together but still cannot
see it

<!DOCTYPE html> 
<html lang='en'> 
<head> 
    <meta charset='utf-8' /> 
	<title>Open Layers Test</title>	
    <script type='text/javascript'
src="http://www.openlayers.org/api/OpenLayers.js"></script>
    <script type='text/javascript'>

    var map;
    
	function init() {
        // Setup our map object
        map = new OpenLayers.Map('map_element', {
        	controls: [
        	new OpenLayers.Control.Navigation()
        	new OpenLayers.Control.PanZoomBar()
        	new OpenLayers.Control.LayerSwitcher()
        	]
        	maxExtent: new OpenLayers.Bounds (-99.269569,19.479910,
-99.224060, 19.524080)
        	maxScale: 15000,
        	minScale: 2500
        	});
        
       // Setup our layer objects
   
    var layer1 = new OpenLayers.Layer.WMS(
		"Caminos",
		"http://173.236.45.118/cgi-bin/mapserv?", 
		{map: '/home/bicimapas/mapdata/BiciMapasMS.map', 
		layers:'caminos'});
			        
    //Add layers to the map
    map.addLayer([layer1]);
        
        // Add a layer switcher control
    map.addControl(new OpenLayers.Control.LayerSwitcher({}));
        
   var map_center = new OpenLayers.LonLat(-99.24801,1949775); 
	 if(!map.getCenter()){
			map.setCenter(map_center);
		}
  	}

    </script>
</head>

<body	onload='init();'> mapa de prueba
    <div id='map_element' style='width: 500px; height: 500px;'>
	</div>
</body>
</html>

What should be changed?

Alberto Najera

De: Arnd Wippermann [mailto:arnd.wippermann at web.de] 
Enviado el: sábado, 28 de abril de 2012 05:14 p.m.
Para: 'Alberto Najera'
CC: mapserver-users at lists.osgeo.org
Asunto: AW: [mapserver-users] Open Layers Problem

your server
http://173.236.45.118/cgi-bin/mapserv?map=/home/bicimapas/mapdata/BiciMapasM
S.map
works also well with OpenLayers.
 
This should show your server with OpenLayers:
 
http://gis.ibbeck.de/olclient/OLClient.asp?WMC=./data/WMC/BiciMapasMS.wmc.xm
l
 
Perhaps you use not the right zoomlevel in OpenLayers to see anything. I
have to use zoomlevel 16 to see something.
 
by the way also you have corrected it, the mapfile path have to be a
filesystem path and not an url.
 
Arnd



More information about the mapserver-users mailing list