Don't know what I'm doing wrong; trying to load layers from ArcGIS Server into web using 'ArcGISDynamicMapServiceLayer', can see the basemap but not the layer.

see code below:




<link rel="stylesheet" href="https://js.arcgis.com/3.19/esri/css/esri.css">

<script src="https://js.arcgis.com/3.19/"></script>



 // Add data from ArcGIS Server

var featureLayer = new esri.layers.ArcGISDynamicMapServiceLayer("https://herse.chelmsford.chelmsfordbc:6443/arcgis/rest/services//Boundaries/MapServer/2");


  • There is an extra "/" in the path for the feature layer url (.../services//Boundaries/...). Did you see any errors in your console? Also, why are you loading the FeatureLayer module but using "esri.layers.ArcGISDynamicMapServiceLayer" – kenbuja May 17 '17 at 12:08
  • Hi Kenbuja, didn't get an error. on the FeatureLayer load, what will be the best way to load a layer from ArcGIS server. – Matilda Ajiri May 17 '17 at 12:17
  • var featureLayer = new FeatureLayer("herse.chelmsford.chelmsfordbc:6443/arcgis/rest/services/…); – kenbuja May 17 '17 at 13:25

You are trying to add a Feature Layer using a ArcGISDynamicMapServiceLayer, which is not the right class. Use FeatureLayer instead (see the example in the ESRI Documentation)

var featureLayer = new FeatureLayer("https://herse.chelmsford.chelmsfordbc:6443/arcgis/rest/services//Boundaries/MapServer/2");

If you want to really add a Dynamic Map Service, instead of a Feature Layer, then check this out.

Note: You need first to create a Map object before add the feature layer to it. I think you did it, because you can see the basemap, but just in case...

| improve this answer | |
  • Thanks Katah, I do have mybase map. I have made changes still unable to see the layer; // layer from server. var featureLayer = new FeatureLayer("https:\\herse.chelmsford.chelmsfordbc:6443/arcgis/rest/services/Ordnance_Survey/Boundaries/MapServer/1"); map.addLayer(featureLayer); – Matilda Ajiri May 18 '17 at 11:49
  • @MatildaAjiri Please check the following: - 1 Try to add first a "sample" layer from ArcGIS. For example this. Is it working? - 2 Check the type of your layer. For that go to your Layer URL and the fourth property should be the type. Which type of Layer do you have? – Katah May 22 '17 at 8:21

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.