AnsweredAssumed Answered

How to add a OGC WMS layer to application using Javascript API 4.12

Question asked by PHoltzhausen on Sep 11, 2019
Latest reply on Nov 25, 2019 by fcbassongis

I am trying to load the WMS layers into my JavaScript application, but I get a "failed to fetch” error message.

 

Her is my js code to just display the resource in an empty map:

      require([

        "esri/Map",

        "esri/views/MapView",

        "esri/layers/WMSLayer"

      ], function(Map, MapView, WMSLayer) {

        var layer = new WMSLayer({

          url:

            "http://apollo.cdngiportal.co.za/erdas-iws/ogc/wms/CDNGI_PORTAL_BACKDROP?",

          sublayers: [

            {

              name: "CDNGI_2mil_Mosaic"

            }

          ]

        });

 

        var map = new Map({

          layers: [layer]

        });

        var view = new MapView({

          container: "viewDiv",

          map: map,

          spatialReference: 4326,

        });

      });

 

 

 

Any guidance would be much appreciated,

Pieter

Outcomes