jeff.pace

3.0 api error adding WMS layer. first one fails all rest are ok.

Discussion created by jeff.pace on Jun 19, 2012
I am having trouble loading WMS layers in the new api.  After I create my WMS layer, I do map.addLayer(layer) . On the first WMS layer, I get

error Loading map service at url: http://www.mymanatee.org/lizardtech/iserv/ows TypeError: _9.spatialReference is null
MapManager


however, the line before add layer is

console.log("mm llh: "+layer.id + " "+layer.spatialReference.wkid );


which results in

mm llh: 2011 Aerials 102100


so the spatial reference is set properly.  I am looping through 6 layers, 1st one always fails, next 5 always succeed.  Regardless of order.

The result is the layer draws!!! however it is created on top of the graphics layer.

I reported this before, but wanted to re-report now that 3.0 is final. 

Code for creating layer
mapServiceInfo.label = "2011"
mapServiceInfo.url = "http://www.mymanatee.org/lizardtech/iserv/ows"
mapServiceInfo.catalog = "2011"

2003, 2007, 2008, 2009, 2010, 2011 are all valid values


  else if (mapServiceInfo.type === "wms") {
                   var layerInfo = new esri.layers.WMSLayerInfo({
                        "name":mapServiceInfo.label,
                        "title":mapServiceInfo.label
                        });
                    var resourceInfo = {
                        extent: new esri.geometry.Extent({
                            "xmin":-9214584.290114,
                            "ymin":3145848.430227,
                            "xmax":-9133734.228469,
                            "ymax":3208214.597832,
                            
                                "wkid": 102100
                            
                            }),
                        layerInfos: [layerInfo],
                            version:"1.1.1"
                        };
                            layer = new esri.layers.WMSLayer(mapServiceInfo.url, {
                            resourceInfo: resourceInfo,
                            id: mapServiceInfo.label,
                            visibleLayers: [mapServiceInfo.catalog],
                            type: "wms"
                    });

Outcomes