AnsweredAssumed Answered

get the spatial objects from a layer with JS code

Question asked by sciolofan on Jan 1, 2014
Latest reply on Jan 21, 2014 by JUihlein-esristaff
Dear all,

I've created a layer in ArcMap consisting of five icons placed over a topographic basemap. These 5 icons corrsponds to 5 sensors deployed on a river. These 5 objects have each of them a set of attributes ({FID}, {Model}, {Property},...).
Then I imported the layer in ArcGIS online where I have created a map with this layer.
In a web app, in js code I use the mapID to retrieve the map, something like
 arcgisUtils.createMap("f2c2d805.........................", "map").then(function(response){                         window.map = response.map;                         //set the popup's popupWindow property to false. This prevents the popup from displaying                         map.infoWindow.set("popupWindow", false);                         initializeSidebar(window.map);  }, function(error){                         console.log("Map creation failed: ", dojo.toJson(error));                     });


So far is ok, but now i want to programatically retrieve all the 5 objects composing the layer and for each object to get the set of attribute? How can I do that?

P.S
I tried this example
https://developers.arcgis.com/en/javascript/jssamples/map_showproperties.html  in the sandbox and what i changed was this part
 var map = new Map("mapDiv");           var basemap = new ArcGISTiledMapServiceLayer("http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/TaxParcel/AssessorsBasemap/MapServer");           map.addLayer(basemap);            var census = new ArcGISDynamicMapServiceLayer("http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer", {             "id": "census",             "opacity": 0.5           });           map.addLayer(census);

which i replaced with the invocation of my map
     var mapid="f2c2d805..........................."    var map = esri.arcgis.utils.createMap(mapid, "map", {       mapOptions: {         slider: true,         nav:false       }     });

which did not work - what I got in the result pane was a blank page.

Any help is much appreciated
thanks,
Sorin

Outcomes