|Home | Products | Issue Tracker | FAQ | Download|
Another exciting feature of MapServer is its ability to use layers from other map servers. In this case, a MapServer application becomes a WMS (or WFS) client. MapServer can also share (or serve up) the layers in the mapfile to other map servers. This makes an application a WMS (or WFS) server. What is WMS or WFS? These are “web-based interoperability service” specifications published by the Open Geospatial Consortium (OGC). WMS stands for Web Map Service and WFS for Web Feature Service. The difference between these two specifications, in simple terms, is that WMS uses web raster formats (PNG, GIF, JPEG) to share layers while WFS uses GML, the Geography Markup Language. A third OGC interoperability specification is the Web Coverage Services specification or WCS. MapServer supports WCS at the server level only. To find more information about WMS, WFS, and WCS go the the OGC’s web site and look for the OGC Implementation Specifications or OGC Abstract Specifications. The MapServer web site also has documentation and WIKI pages for these specifications.
This example shows you how to add a WMS layer in your mapfile.
This is what the mapfile looks like: Example1-7.map
Let’s have a look at the WMS layer:
The type of LAYER connection to use. The default is LOCAL.
If we have to be explicit, we would add CONNECTIONTYPE LOCAL to all othe vector and raster layers in our mapfile. Instead we only define connection types that are external. WMS is an external data layer, coming from another map server.
To know more about adding WMS layers to your applications, please visit the MapServer WMS Client Howto.
In addition to adding the WMS layer object, there’s also a new object under MAP. This is the WEB object. Within the WEB object are two parameters:
Finally, within the MAP object, I added a new parameter: NAME. This is the identifier for the MAP object. MapServer uses this as prefix to all images it creates and dumps to the tmp directory. It’s not needed at this point but it also doesn’t hurt to have it.
If you would like to share your data layers to other map servers, you will need to add METADATA objects within your MAP object and within each of the LAYER objects you would like to share. All the WMS layers that you added from another server will automatically be cascaded and will also become available to others. To know more about how to make your MapServer application become a WMS server, please read the MapServer WMS Server HowTo. Documentation also exists for configuring MapServer applications to support the WFS standard, both as a server and as a client.