1

I have an WMS layer which is a cross domain resource and I wanted to embed those layers as basemap in my application using JavaScript api rather than using built in ArcGIS Basemaps.

WMS Layer is complaint with OGC WMS specification & it has 5 different layers of Aerial photography images.

If it is possible, can you add these layers a basemaps in my application. Can you please piont me in the right direction.

1 Answer 1

1

You can't add a custom Layer as A BaseMap. What you can do is to initialise the Map without an BaseMap, and then add the WMS Layer.

You can include a WMS layer in your ESRI JSAPI app, by using the esri.layers.WMSLayer class.

Here is how you can do it:

var layer1 = new esri.layers.WMSLayerInfo({name:"1",title:"Rivers"});
var layer2 = new esri.layers.WMSLayerInfo({name:"2",title:"Cities"});
var wmsLayer = new esri.layers.WMSLayer(
"http://sampleserver1.arcgisonline.com/ArcGIS/services/Specialty/ESRI_StatesCitiesRivers_USA/MapServer/WMSServer",
  {resourceInfo: resourceInfo,
  visibleLayers: ["1","2"]
  }
); 
map.addLayers([wmsLayer]);

A sample is available here: https://developers.arcgis.com/en/javascript/jssamples/layers_wmsresourceinfo.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.