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>
-
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– kenbuja2017年05月17日 12:08:07 +00:00Commented 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.Matilda Ajiri– Matilda Ajiri2017年05月17日 12:17:07 +00:00Commented May 17, 2017 at 12:17
-
var featureLayer = new FeatureLayer("herse.chelmsford.chelmsfordbc:6443/arcgis/rest/services/…);kenbuja– kenbuja2017年05月17日 13:25:52 +00:00Commented May 17, 2017 at 13:25
1 Answer 1
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...
-
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– Matilda Ajiri2017年05月18日 11:49:05 +00:00Commented 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?Katah– Katah2017年05月22日 08:21:20 +00:00Commented May 22, 2017 at 8:21
Explore related questions
See similar questions with these tags.