[OpenLayers-Users] Call Mapfile layer with Openlayers
when status ON or OFF
Christopher Schmidt
crschmidt at metacarta.com
Wed Sep 9 08:41:36 EDT 2009
On Wed, Sep 09, 2009 at 08:00:42AM -0400, Alexandre Dube wrote:
> Hi Paul,
>
> You can copy the image url by right clicking on it and open it in a new
> window. You'll see the request url constructed by OpenLayers and maybe
> an error message from MapServer.
>
> I noticed that you use the "map" parameter. WMS has no such parameter so
> it should be part of your main url, like below.
For the record:
There is no difference between putting ?map= in the URL and putting map:
in the parameters. Parameters are just strings sent to the server; no
processing is done on them.
-- Chris
>Also, if you look in the
> OpenLayers/Layer/WMS.js code, you'll see that this object takes 4
> parameters, the 3e being the server-side "parameters" and the 4th being
> the OpenLayers object "options". min/maxZoomLevel are not parameters but
> OL options.
>
> layer1 = new OpenLayers.Layer.WMS(
> "OpenLayers WMS",
>
> "http://127.0.0.1/cgi-bin/mapserv.exe?map=/ms4w/apps/openlayers-2.5/data/uk2.map&",
> { layers: "uk"},
>
> { gutter: 15, minZoomLevel: 1, maxZoomLevel: 4 }
> );
>
>
> If you still get pink tiles, copy the link in a new window to see the error.
>
> Regards,
>
> Alexandre
>
> Paul Curran wrote:
> >
> > 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
> >
>
>
> --
> Alexandre Dubé
> Mapgears
> www.mapgears.com
>
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
--
Christopher Schmidt
MetaCarta
More information about the Users
mailing list