Select to view content in your preferred language

get a feature class from a ArcGISDynamicMapServiceLayer

977
1
Jump to solution
01-15-2014 05:15 AM
MaxDemars
Deactivated User
Hi,

I have published a map as a service with ArcGIS Server. I have built my simple map like this:

    require(["esri/map", "dojo/domReady!", "esri/layers/ArcGISDynamicMapServiceLayer", "esri/SpatialReference",], function(Map) {       layer1 = new esri.layers.ArcGISDynamicMapServiceLayer("http://localhost:6080/arcgis/rest/services/carte1/MapServer", {         'opacity': 0.75       });       map = new Map("maptest1", {         basemap: "topo"       });       map.addLayers([layer1]);       map.on("layers-add-result", function(){       var extent = layer1.fullExtent;       map.setExtent(extent);              });     });


I would like to use a published geoprocess in the map and select a particular feature class from the ArcGISDynamicMapServiceLayer as input.

Is it possible? If I do map.getLayer("layer1") will I retrieve all features class that was published in the map? What is the method to do what I am trying to do?

Thank you a lot!
0 Kudos
1 Solution

Accepted Solutions
RobertoPepato
Deactivated User
All map services exposes its feature layers as feature services on and index based url through REST services. For example, if you have a map service address stored on a mapServiceHttpAddress variable and want to get a reference for a feature layer published through this map service you can use something like:

   var featureLayerHttpAddress = mapServiceHttpAddress + "/" + index;

where index is the indexer of the feature service that you want to get. After this, getting a reference to the feature layer is straightforward:

      var layer = new FeatureLayer(featureLayerHttpAddress);

Take a look at: https://developers.arcgis.com/en/javascript/jsapi/featurelayer-amd.html for more info.

View solution in original post

0 Kudos
1 Reply
RobertoPepato
Deactivated User
All map services exposes its feature layers as feature services on and index based url through REST services. For example, if you have a map service address stored on a mapServiceHttpAddress variable and want to get a reference for a feature layer published through this map service you can use something like:

   var featureLayerHttpAddress = mapServiceHttpAddress + "/" + index;

where index is the indexer of the feature service that you want to get. After this, getting a reference to the feature layer is straightforward:

      var layer = new FeatureLayer(featureLayerHttpAddress);

Take a look at: https://developers.arcgis.com/en/javascript/jsapi/featurelayer-amd.html for more info.
0 Kudos