Select to view content in your preferred language

World Imagery Click to Identify - how is this done? samples? configurable?

847
3
Jump to solution
07-30-2012 12:27 PM
HarryBowman
Deactivated User
I can click and get metadata when the layer is added in ArcMap, and when using the Showcase Imagery Viewer.

The "view source" in the Imagery window seems to refer to a query task, but it was built with API 2.1 and I am wondering if there is a better way: the ImageServiceIdentify? No sample uses this, I think.

Is there a simple sample or a way to configure this capability in one of the online application templates, to ArcGIS Explorer Online, or to ArcGIS Explorer desktop? All I want to do it put an imagery file on the map, click, and get source and date.

[this is a cross post from the ArcGIS Online forum, but it might be a better fit here.]
0 Kudos
1 Solution

Accepted Solutions
StephenLead
Honored Contributor
Hi Harry,

The code for the Identify button says:

<a id="identifyButton" class="map_button identify left" onClick="JavaScript:activateImageQuery()...


In this case, activateImageQuery is a function (not an ArcGIS command). You can find the function in the JS file at http://www.arcgis.com/showcase/javascript/main.js

T
his function sets up the query which will run when you click on the map:

queryImage.execute(query, dojo.hitch(this,showImageQueryFeatures, query));


When this query executes, it calls the function showImageQueryFeatures, which is sent the results of the query as a featureSet. The first feature in this set is then sent to the function showImageQueryFeature:

function showImageQueryFeature(feature) {  var attributes = { name: feature.attributes.NICE_NAME,                     nice_desc: feature.attributes.NICE_DESC,                     src_desc: feature.attributes.SRC_DESC,                     resolution: feature.attributes.SRC_RES,                     accuracy: feature.attributes.SRC_ACC,                     date: feature.attributes.SRC_DATE                 };    feature.setAttributes(attributes);    feature.setInfoTemplate(queryImageTemplate);    map.graphics.add(feature);  }


(the forum editor keeps messing up the code - the point is that it's retrieving the attributes from the feature)

So basically, there is a polygon layer (invisible) sitting on top of the imagery, and this is what is being queried when you click on the map.

Hope this helps,
Steve

View solution in original post

0 Kudos
3 Replies
StephenLead
Honored Contributor
Can you post a link to the showcase imagery viewer that you're referring to?

If it's using a query task an assumption is that there is a polygon layer representing metadata about each image (ie, they are serving the Source and Date as attributes in a polygon layer, with the polygons representing the extent of each image). Clicking on the "image" is actually running a query task against the polygon layer, and returning simple attributes.
0 Kudos
HarryBowman
Deactivated User
Can you post a link to the showcase imagery viewer that you're referring to?

If it's using a query task an assumption is that there is a polygon layer representing metadata about each image (ie, they are serving the Source and Date as attributes in a polygon layer, with the polygons representing the extent of each image). Clicking on the "image" is actually running a query task against the polygon layer, and returning simple attributes.


I think that is what it might be doing.
http://www.arcgis.com/showcase/
0 Kudos
StephenLead
Honored Contributor
Hi Harry,

The code for the Identify button says:

<a id="identifyButton" class="map_button identify left" onClick="JavaScript:activateImageQuery()...


In this case, activateImageQuery is a function (not an ArcGIS command). You can find the function in the JS file at http://www.arcgis.com/showcase/javascript/main.js

T
his function sets up the query which will run when you click on the map:

queryImage.execute(query, dojo.hitch(this,showImageQueryFeatures, query));


When this query executes, it calls the function showImageQueryFeatures, which is sent the results of the query as a featureSet. The first feature in this set is then sent to the function showImageQueryFeature:

function showImageQueryFeature(feature) {  var attributes = { name: feature.attributes.NICE_NAME,                     nice_desc: feature.attributes.NICE_DESC,                     src_desc: feature.attributes.SRC_DESC,                     resolution: feature.attributes.SRC_RES,                     accuracy: feature.attributes.SRC_ACC,                     date: feature.attributes.SRC_DATE                 };    feature.setAttributes(attributes);    feature.setInfoTemplate(queryImageTemplate);    map.graphics.add(feature);  }


(the forum editor keeps messing up the code - the point is that it's retrieving the attributes from the feature)

So basically, there is a polygon layer (invisible) sitting on top of the imagery, and this is what is being queried when you click on the map.

Hope this helps,
Steve
0 Kudos