[mapserver-users] Connecting to remote MapServer WMS/WMF layers using PHP/OpenLayers

Jean-François Gigand jean-francois at gigand.fr
Sat Jan 22 11:05:47 EST 2011


Hi Eric,

The GetCapabilities request would be used to get information about the
WMS map, in order to decide what parameters to give to the
OpenLayers.Layer.WMS object.

In your (static) case, you don't need it in your code. Don't provide
SERVICE nor VERSION (they are set by default), nor REQUEST, as it
should be "GetMap" but this is managed by OpenLayers.Layer.WMS
automatically.
Instead, provide FORMAT ("image/png" or whatever is defined in your
map file), LAYERS (value "all" or comma-separated list of layers).

The GetCapabilities request, however, would help you to check the
effective map parameters :
http://www.catastroloscabos.gob.mx/cgi-bin/mapserv.fcgi?map=/home/juribe/webcatastro/catastro.map&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetCapabilities

Seems you forgot to define the PROJECTION in your map file for each
layer. If it's the same than map's, just copy-paste them to make it
clear for MapServer.
Explained here : http://mapserver.org/ogc/wms_server.html

Good luck,

Jeff

2011/1/22 Eric Jarvies <7 at ericjarvies.com>
>
> Hello,
> I am attempting to connect to a remote MapServer( http://www.catastroloscabos.gob.mx/cgi-bin/mapserv.fcgi?map=/home/juribe/webcatastro/catastro.map& ) and retrieve the respective WMS layers.  However, I am unable to do so for some reason.
> http://loscabosproperties.mx/geoserver/wms.png
> I get the result in XML format, and the map is not displayed.
> The remote MapServer server is located at:
> http://www.catastroloscabos.gob.mx/cgi-bin/mapserv.fcgi?map=/home/juribe/webcatastro/catastro.map&
> In my PHP/OpenLayers doc/code, i have this:
>         var wmsUrl2 = "http://www.catastroloscabos.gob.mx/cgi-bin/mapserv.fcgi";
>         var wms2 = new OpenLayers.Layer.WMS("WMS2",
>             wmsUrl2,
>             { map: '/home/juribe/webcatastro/catastro.map',
>             //layers: 'p',
>             //map_imagetype: 'jpg'
>             SERVICE: 'WMS',
>             VERSION: '1.1.1',
>             REQUEST: 'GetCapabilities'
>             },
>             {singleTile: true, isBaseLayer: false});
>         map.addLayer(wms2);
> Any help would be appreciated.  Thanks!
>
>
>
> _______________________________________________
> mapserver-users mailing list
> mapserver-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-users
>


More information about the mapserver-users mailing list