[OpenLayers-Users] Call Mapfile layer with Openlayers when status ON or OFF

Till Adams adams at terrestris.de
Wed Sep 9 10:13:38 EDT 2009


Paul,

if your mapserver service supports WMS you are not too far away. On my 
first view, I saw, that you add your layernames to the OL-map object and 
not the layer objetcts layer1 and layer2:
So change either to:

      map.addLayers([layer1,layer2]);

or

      map.addLayer(layer1);
      map.addLayer(layer2);

Regards, Till

> Hi
>
>  
>
> I can view my UK Layer via Mapserver with the following 
> url: 'ms4w/cgi-bin/mapserv.exe?mode=map&map=c:mapdirectory*&layer=uk'.* 
> The *&layer=uk *is calling my layer.
>
>  
>
> However I can’t find any documentation on how to call the layer when 
> viewing my map within OpenLayers.
>
>  
>
> I am currently trying to call the layer like this:
>  
>
> var map, layer1, layer2;
>
> var options = { maxExtent: bounds, maxResolution: 600, numZoomLevels: 
> 10};
>
>  
>
> layer1 = new OpenLayers.Layer.WMS("OpenLayers WMS",
>
> "http://127.0.0.1/cgi-bin/mapserv.exe?", { layers: "uk", map: 
> '/ms4w/apps/openlayers-2.5/data/uk2.map',
>
> minZoomLevel: 1, maxZoomLevel: 4 },
>
>       { gutter: 15 });
>
>  
>
>  
>
> layer2 = new OpenLayers.Layer.WMS("OpenLayers WMS",
>
> "http://127.0.0.1/cgi-bin/mapserv.exe?", { layers: "250", map: 
> '/ms4w/apps/openlayers-2.5/data/uk2.map',
>
> minZoomLevel: 5, maxZoomLevel: 10},
>
>       { gutter: 15 });
>
>  
>
>       map.addLayer(uk, 250);
>
>       map.zoomToExtent(bounds);
>
>       map.setCenter(bounds);
>
>       map.zoomToMaxExtent();
>
>  
>
> However I am just seeing pink tiles within OpenLayers.
>
>  
>
> Note: If my layers are set to default within my Mapfile all my layers 
> are displayed.
>
>  
>
> Thanks for any help in advance
>
>  
>
> Paul
>
>  
>
>  
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>   


-- 
----------------------------------------------------------
terrestris GmbH & Co. KG
Irmintrudisstrasse 17
53111 Bonn
Germany

Till Adams
Geschäftsführung

Tel: +49 (0)228 / 962 899-52
Fax: +49 (0)228 / 962 899-57
adams at terrestris.de http://www.terrestris.de
Amtsgericht Bonn, HRA 6835
---------------------------------------------------------

Komplementärin:

terrestris Verwaltungs GmbH

vertreten durch:
Hinrich Paulsen, Till Adams




More information about the Users mailing list