How can I get the description from a layer?

1170
6
Jump to solution
12-05-2016 05:05 PM
RolandoFlorez
New Contributor III

I have this layers (Series of images)

inside each one, there are this:

I need this information (now empty) to show in a infowindow. How can access to this?

0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

Rolando,

   You can get this date by getting the description property of a FeatureLayer:

FeatureLayer | API Reference | ArcGIS API for JavaScript 3.18 | Description

Or you can use esriRequest to get this as well. 

View solution in original post

6 Replies
RobertScheitlin__GISP
MVP Emeritus

Rolando,

   You can get this date by getting the description property of a FeatureLayer:

FeatureLayer | API Reference | ArcGIS API for JavaScript 3.18 | Description

Or you can use esriRequest to get this as well. 

RolandoFlorez
New Contributor III

thanks Robert,

But I want to know anything else:
Suppose that I click on map, right? So, the map is composed by little rectangs [0,1,2 ... sublayers or really, satellital images] at respective places. How can I get what layer (or rectangle of satellital image) I am clicking?

(sorry, if this question should not be here, I will republish it again)

Thanks a lot.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Rolando,

   OK that is a very different question then. You would use the IdentifyTask for that.

RolandoFlorez
New Contributor III

Thanks Rober, It was really helpful.

0 Kudos
RolandoFlorez
New Contributor III

Robert,
Can you explain me this example?
At this lines:
// InfoWindow expects an array of features from each deferred
// object that you pass. If the response from the task execution
// above is not an array of features, then you need to add a callback
// like the one above to post-process the response and return an
// array of features.
map.infoWindow.setFeatures([deferred]);

yes, it has comments but I don't understand.
Instead,
   var deferred = identifyTask
   .execute(identifyParams)
   .addCallback(function (response) {..} ,
I'm making,
   identifyTask.execute(identifyParams, function (response) {..} .

Instead .setFeatures([deferred]), I'm sending .setFeatures(feature), where feature = response[0].feature, and is saving the infoTemplate.

When I click the map, the infoWindow content is 'No information', Why?

Thanks a lot.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Rolando,

   The answer is simple a deferred like the identify task returns an array of graphics and the map.infoWindow.setFeatures ia expecting an array of graphics. So you just have to make an array of graphics out of your graphics response and not a single graphic like you are now "setFeatures(feature)".

0 Kudos