1

I want to display layers of a WMS service containing sublayers on ArcGIS using JavaScript 3. No layers appear, but the WMSLayer is marked as loaded.

the WMS is described here:

data shom WMS

My code is here :

esri.config.defaults.io.corsEnabledServers.push('https://services.data.shom.fr');

  var layer1 = new WMSLayerInfo({
    name: 'VAGUES_WW3_R1250_MISTRAL-1000M_*',
    title: 'Vagues Mistral'
  });
  var layer2 = new WMSLayerInfo({
    name: 'VAGUES_MFWAM_R0000_GLOB05/Direction_of_wind_waves_msl',
    title: 'Vagues Provence est'
  });
  var resourceInfo = {
    extent: new Extent(2.071094, 42.30868, 7.080859, 44.251969, {
      wkid: 4326
    }),
    layerInfos: [layer1, layer2]
  };

  var wmsLayer = new WMSLayer('https://services.data.shom.fr/ncwms2/wms?SERVICE=WMS&VERSION=1.3.0&REQUEST=GetMap&FORMAT=image%2Fpng&LAYERS=VAGUES_WW3_R1221_PROVENCE-OUEST-200M/Secondary_wave_mean_period_msl&BBOX=2.071094%2C42.30868%2C7.080859%2C44.251969&TIME=2018-10-10T02:00:00.00Z&WIDTH=1024&HEIGHT=1024&CRS=CRS%3A84', {


visibleLayers:['VAGUES_WW3_R1243_CORSE-EST-200M/Secondary_wave_mean_period_msl','VAGUES_MFWAM_R0000_GLOB05/u0']
  });

  map.addLayers([wmsLayer]);
2

Looking at the service response for your snippet, it says:

<ServiceException code="OperationNotSupported">
    Only 1 layer may be requested
</ServiceException>

Seems like they only allow you to specify one single layer in the visibleLayers, for example:

visibleLayers:['VAGUES_MFWAM_R0000_GLOB05/u0']

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.