Version 3 (modified by amorsell, 11 years ago) (diff)


Overriding WMS Settings for MapGuide? Open Source Consumption

Configuration of WMS feature sources within MapGuide? Open Source is generally done using one of the commercial (such as Autodesk MapGuide? Studio) or open source (such as Webstudio) GUI's. Unfortunately, these GUI's currently do not allow the overriding of configuration information used in the WMS requests. Examples of these configuration options include:

  • Image transparency
  • Image format (png, jpeg, gif, etc)
  • Image background color
  • Coordinate system
  • Displaying of multiple WMS layers in a single MapGuide? layer

Configuration Document

This section describes how to create the configuration document for the MapGuide? WMS feature source.

Get the Capabilities Document

Before anything can be done, you should get the capabilities document for the WMS service. This document contains the list of all the layers and possible values that can be used for the configuration parameters. To do this: Start a web browser and go to the location http://<WMSServiceAddress>?service=wms&request=GetCapabilities?

Basic Configuration Document

This section describes a basic configuration document that configures and exposes a single WMS layer.

Copy the following XML to a text editor.

<?xml version="1.0" encoding="UTF-8"?>
<DataStore xmlns:fdo="" xmlns:gml="" xmlns:xs="" xmlns:xsi="" xmlns:xlink="" xmlns="" xsi:schemaLocation=" FdoDocument.xsd">
  <xs:schema xmlns:xs="" targetNamespace="" xmlns:fdo="" xmlns:WMS="" elementFormDefault="qualified" attributeFormDefault="unqualified">
    <xs:element name="%FeatureClassName%" type="WMS:%FeatureClassName%" abstract="false" substitutionGroup="gml:_Feature">
      <xs:key name="%FeatureClassName%Key">
        <xs:selector xpath=".//%FeatureClassName%"/>
        <xs:field xpath="Id"/>
    <xs:complexType name="%FeatureClassName%" abstract="false">
        <xs:extension base="gml:AbstractFeatureType">
            <xs:element name="Id">
                <xs:restriction base="xs:string">
                  <xs:maxLength value="256"/>
            <xs:element name="Image" type="fdo:RasterPropertyType" fdo:defaultImageXSize="800" fdo:defaultImageYSize="600">
                <xs:appinfo source="">
                  <fdo:DefaultDataModel organization="Row" bitsPerPixel="32" tileSizeX="100" tileSizeY="100"/>
  <SchemaMapping provider="OSGeo.WMS.3.1" name="WMS" xmlns="">
    <complexType name="%FeatureClassName%">
      <RasterDefinition name="Image">
        <Layer name="%LayerName%">

Substitute %FeatureClassName% with a descriptive name of your choosing (do not use “.” in the name, and until you get this working it is best to keep it limited to ascii characters).

Substitute %LayerName% with the name of the WMS layer that you want to display. For example, if the following entry occurs in WMS capabilities document: <Layer queryable="1" opaque="0" noSubsets="0">

<Name>theLayerName</Name> <Title>The layer title</Title>

</Layer> then substitute %LayerName% with theLayerName.

At the end of the document are the following configuration parameters that can be adjusted as appropriate:

  • Format – used to specify the image type. The possible values here are in the WMS capabilities document in the GetMap? section. Do not include the “image/” part of the format here. That is, if the desired format is specified in the WMS capabilities document as “image/png”, put “png” in the configuration document.
  • Transparent – if the WMS Service supports transparency then specifying true here will make the background of the returned image transparent. This transparency is preserved in MapGuide? so any layers that this WMS layer is placed over will show through the transparent regions.
  • BackgroundColor – if the WMS Service supports specifying background colors, set the RGB value (e.g., 0xFFFFFF=white, 0x000000=black, 0x0000FF=blue, 0xFF0000=red, 0x00FF00=green), here for the color.
  • Time – time value of the desired WMS layers.
  • Elevation – elevation of the desired WMS layers.
  • SpatialContext – the spatial reference system to be used for the map. The list of possible values here are described in the WMS capabilities document. Typically EPSG:4326 will work.
  • Layer – the name of the layer and the style to apply to it. The list of possible styles is listed in the WMS capabilities document. For example, if “visual” was a possible style for the layer then <Style>visual</Style> could be added.

Once the substitutions have been made save the file.

Multiple WMS Layers in a Single MapGuide? Layer

To get multiple WMS layers in a single MapGuide? layer, it is enough to specify multiple Layer tags in the configuration document. When the resulting feature class (i.e., name substituted for %FeatureClassName%) is specified in a layer, the layer will display all of the specified WMS layers. The following XML snippet shows how the multiple layers are specified:

<RasterDefinition name="Image">
        <Layer name="%LayerName1%">
        <Layer name="%LayerName2%">
        <Layer name="%LayerName3%">

Attachments (3)

Download all attachments as: .zip