Should the options parameter image format work as I have below? When you set the value for image format by wmsLayer.setImageFormat('svg') it works, but via options.format it's ignored?Any thoughts? I'm after a gif 🙂 all I can get is svg or png? Does setting a background colour still require you use a custom wms layer like http://help.arcgis.com/en/webapi/javascript/arcgis/help/jssamples/layers_custom_wms.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
 <head>
   <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
   <meta http-equiv="X-UA-Compatible" content="IE=7,IE=9" /> Â
  <!--The viewport meta tag is used to improve the presentation and behavior of the samples
     on iOS devices-->
   <meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no"/>
   <title>Map with WMS</title>
   <link rel="stylesheet" type="text/css" href="http://serverapi.arcgisonline.com/jsapi/arcgis/2.7/js/dojo/dijit/themes/claro/claro.css">
   <style>
     html, body { height: 98%; width: 98%; margin: 0; padding: 5px; }
   </style>
   <script type="text/javascript">var djConfig = {parseOnLoad: true};</script>
   <script type="text/javascript" src="http://serverapi.arcgisonline.com/jsapi/arcgis/?v=2.7"></script>
  Â
   <script type="text/javascript">
     dojo.require("dijit.layout.BorderContainer");
     dojo.require("dijit.layout.ContentPane");
     dojo.require("dijit.layout.AccordionContainer");
     dojo.require("esri.map");
     dojo.require("esri.layers.wms");
   Â
     var map;
     function init() {
       //esri.config.defaults.io.proxyUrl = "http://localhost:8080/sampleapp/proxy.jsp";//"/arcgisserver/apis/javascript/proxy/proxy.ashx";
       var initExtent = new esri.geometry.Extent({"xmin":-19000410,"ymin":860986,"xmax":606604,"ymax":8570731,"spatialReference":{"wkid":102100}});
       map = new esri.Map("map",{extent:initExtent});      Â
     Â
       var layer2 = new esri.layers.WMSLayerInfo({name:"2", title:"test"});
       var resourceInfo2 = {
         extent: initExtent,
         layerInfos: [layer2]        Â
       };
      Â
       var options = { resourceInfo: resourceInfo2, visibleLayers: ['2'], format: 'gif' };
     Â
       var wmsLayer = new esri.layers.WMSLayer("http://sampleserver1.arcgisonline.com/ArcGIS/services/Specialty/ESRI_StatesCitiesRivers_USA/MapServer/WMSServer",options);
       //works here but not above? and only for svg, not gif
       //wmsLayer.setImageFormat("gif");
       console.debug(wmsLayer.imageFormat);
       map.addLayer(wmsLayer);
    Â
       dojo.connect(map, 'onLoad', function(theMap) {
         //resize the map when the browser resizes
         dojo.connect(dijit.byId('map'), 'resize', map,map.resize);
       });
     }
     dojo.addOnLoad(init);
   </script>
 </head>
Â
 <body class="claro">
   <div id="content" dojotype="dijit.layout.BorderContainer" design="headline" gutters="true" style="width: 100%; height: 100%; margin: 0;">
     <div id="map" dojotype="dijit.layout.ContentPane" region="center" style="overflow:hidden;">
     </div>
   </div>
 </body>
</html>