0

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:

<html>
<head>
<
<title>FeatureLayer</title>
<link rel="stylesheet" href="https://js.arcgis.com/3.19/esri/css/esri.css">
<script src="https://js.arcgis.com/3.19/"></script>
<script>
require([
 "esri/map",
 "esri/layers/FeatureLayer",
 "dojo/domReady!"
 ],
function(
 Map,
 FeatureLayer
 )
 {
 // Add data from ArcGIS Server
var featureLayer = new esri.layers.ArcGISDynamicMapServiceLayer("https://herse.chelmsford.chelmsfordbc:6443/arcgis/rest/services//Boundaries/MapServer/2");
map.add(featureLayer);
 });
</script>
alphabetasoup
9,1234 gold badges43 silver badges81 bronze badges
asked May 17, 2017 at 9:37
3
  • 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" Commented May 17, 2017 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. Commented May 17, 2017 at 12:17
  • var featureLayer = new FeatureLayer("herse.chelmsford.chelmsfordbc:6443/arcgis/rest/services/…); Commented May 17, 2017 at 13:25

1 Answer 1

2

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");
map.addLayer(featureLayer);

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...

answered May 17, 2017 at 16:08
2
  • 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); Commented May 18, 2017 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? Commented May 22, 2017 at 8:21

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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.