AnsweredAssumed Answered

WMSLayer: Failer to load layer... XML Parse Error? 

Question asked by venky1995_uwyo on Apr 2, 2020

Hi All, 

 

My Frontend framework is React.js and I am using the esri-loader for ArcGIS purpose. I am trying to load a WMS Layer on my Map which throws an error at the end saying ....

 

[esri.layers.WMSLayer] #load() Failed to load layer (title: 'Layer', id: '1713b9d394f-layer-0') dname: "request:server"message: "XML Parse error"details: {url: "http://localhost:3001/wms", requestOptions: {…}, ssl: false, httpStatus: 0, getHeader: ƒ, …}__proto__: a

 

The reponse for this gives the appopriate image for the filter used, but the layer fails to load. It has an XML error which is weird to me. I can check and confirm the response image from the network tab on the browser.

 

Here is my code...... 

var layer = new WMSLayer({
url: "/wms?SERVICE=WMS&REQUEST=GetMap&FORMAT=image/png&TRANSPARENT=TRUE&STYLES=&VERSION=1.3.0&LAYERS=generalized_observations,generalized_distribution_models&WIDTH=1213&HEIGHT=977&CRS=EPSG:102100&BBOX=-12620287.761277478,4667834.219005647,-11136797.916319173,5862697.845159206&cql_filter=taxon_id%3D%273699%27%3Btaxon_id%3D%273699%27%20AND%20model_mean%20%3E%200&crs=EPSG%3A3857", // url to the service,
});

 

 

Any help is greatly appreciated! Thanks! 

 

 var layer = new WMSLayer({
        url: "/wms?SERVICE=WMS&REQUEST=GetMap&FORMAT=image/png&TRANSPARENT=TRUE&STYLES=&VERSION=1.3.0&LAYERS=generalized_observations,generalized_distribution_models&WIDTH=1213&HEIGHT=977&CRS=EPSG:102100&BBOX=-12620287.761277478,4667834.219005647,-11136797.916319173,5862697.845159206&cql_filter=taxon_id%3D%273699%27%3Btaxon_id%3D%273699%27%20AND%20model_mean%20%3E%200&crs=EPSG%3A3857", // url to the service,
      });

 

      // var layerRoads = new WMSLayer({
      //   url: "https://ows.terrestris.de/osm/service",
      //   sublayers: [
      //     {
      //       name: "OSM-WMS"
      //     }
      //   ]
      // });

      console.log(layer)
      
      const map = new Map({
        //basemap: "topo",
        basemap: {
          baseLayers : [layer],
          visible: true
        },
        //layers: [layer2]
      });

      this.view = new MapView({
        container: this.mapRef.current,
        map: map,
        spatialReference: [3857,3857,3857],
        // center: [-107, 43],
        // zoom: 7  ,
       
      });

Outcomes