Forum/KB - Mapping

Add WMS layers

Ben Huang
posted this on February 23, 2011 13:28

WMS layers are supported in ESRI Viewer 3.8+

 

Step 1: Launch Map Studio, configure base map and other map services first.

 

Step 2: Add another map service that is not required in this map configuration.

 

Step 3: Use Copy XML button to copy map configuration and paste it into a text editor.

 

 

<mapServiceLayer id="WMS" url="http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Specialt..." showSublayer="false" serverType="wms" alpha="1.0" visible="true" disable="false" load="true" label="WMS" format="png8" supportIdentify="true">
        <visibleLayers>
          <id>0</id>
 <id>1</id>
 <id>2</id>
        </visibleLayers>
        <displayNames>
          <displayName id="0" value="Cities"/>
 <displayName id="1" value="Rivers"/>
 <displayName id="2" value="States"/>
        </displayNames>
      </mapServiceLayer>

<mapServiceLayer id="WMS" url="http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Specialt..."

showSublayer="false" serverType="wms" alpha="1.0" visible="true" disable="false" load="true" label="WMS" format="png8" supportIdentify="true">        

  <visibleLayers>        

    <id>0</id>

    <id>1</id>

    <id>2</id>      

  </visibleLayers>      

  <displayNames>        

    <displayName id="0" value="Cities"/>  

    <displayName id="1" value="Rivers"/>  

    <displayName id="2" value="States"/>        

  </displayNames>      

</mapServiceLayer>

Where the Layer ID's are replaced by the layer names in the GetCapabilities XML of the WMS Service

The GetCapabilities request can be issued by navigating to [your WMS url]?request=GetCapabilities and will return a structure similar to:

<Layer queryable="1">
                <Name>FIRE_DISTURBANCE_AREA_1995</Name>
                <Title>Fire Perimeters</Title>
                <LatLonBoundingBox minx="-95.2273407" miny="41.7456042" maxx="-76.1224442" maxy="56.5489539" />
                <BoundingBox SRS="EPSG:4269" minx="-95.2273407" miny="41.7456042" maxx="-76.1224442" maxy="56.5489539" resx="1" resy="1" />
                <MetadataURL type="FGDC">
                    <Format>text/plain</Format>
                    <OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="/FIRE_DISTURBANCE_AREA_1995.txt" xlink:type="simple" />
                </MetadataURL>
                <MetadataURL type="FGDC">
                    <Format>text/xml</Format>
                    <OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="/FIRE_DISTURBANCE_AREA_1995.xml" xlink:type="simple" />
                </MetadataURL>
            </Layer>
            <Layer queryable="1">
                <Name>FIRE_DISTURBANCE_AREA_1994</Name>
                <Title>Fire Perimeters</Title>
                <LatLonBoundingBox minx="-95.2273407" miny="41.7456042" maxx="-76.1224442" maxy="56.5489539" />
                <BoundingBox SRS="EPSG:4269" minx="-95.2273407" miny="41.7456042" maxx="-76.1224442" maxy="56.5489539" resx="1" resy="1" />
                <MetadataURL type="FGDC">
                    <Format>text/plain</Format>
                    <OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="/FIRE_DISTURBANCE_AREA_1994.txt" xlink:type="simple" />
                </MetadataURL>
                <MetadataURL type="FGDC">
                    <Format>text/xml</Format>
                    <OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="/FIRE_DISTURBANCE_AREA_1994.xml" xlink:type="simple" />
                </MetadataURL>

</Layer>

 

The layer names are in bold above.

 

Step 4: Locate the map service added in step 2, modify it to be a WMS service.

  • Replace the url with the url to the WMS service
  • Change serverType to "wms" (lower case)
  • Add visibleLayers and displayNames if they are different from the map service in step 2

 

Step 5: Copy this map configuration and use Edit XML button to paste it back in Map Studio.

 

Step 6: Save & Exit.