Select to view content in your preferred language

Identify Widget for FlexViewer 2.1

60362
266
09-23-2010 11:34 AM
RobertScheitlin__GISP
MVP Emeritus
All,

   I have been waiting for the Final release of the FlexViewer 2.1 before I started to push out some widgets I have been working on.

Here is my Identify Widget for Flex Viewer 2.1. I have tested to ensure proper functioning with FlexViewer 2.1 and am now releasing it to you since the API Team did not get one into the FlexViewer.

Here is the link:

http://www.arcgis.com/home/item.html?id=39cf66d58c234279ba728c50461a1a89

More FlexViewer 2.1 widgets to come stay tuned...
Tags (2)
0 Kudos
266 Replies
RobertScheitlin__GISP
MVP Emeritus
Will,

    If you only want one layer of one particular map service and that is it than you need to look at the identifyFeatures function in the IdentifyWidget.mxml and basically delete all the for loop an just hard code the identifyParams and identify task something like this

private function identifyFeatures():void
   {
    var identifyParams : IdentifyParameters = new IdentifyParameters();
    identifyParams.returnGeometry = false;
    identifyParams.tolerance = identifyTolerance;
    identifyParams.geometry = identifyPoint;
    identifyParams.width = map.width;
    identifyParams.height = map.height;
    identifyParams.mapExtent = map.extent;
    identifyParams.spatialReference = map.spatialReference;
                                                   //You have to know the id number of your layer here
                                                   identifyParams.layerIds = [23];
                                                   var identifyTask:IdentifyTask = new IdentifyTask("http://yourserver/arcgis/yourservice/mapserver);
    identifyTask.addEventListener(IdentifyEvent.EXECUTE_COMPLETE, onResult);
    identifyTask.addEventListener(FaultEvent.FAULT, onFault);
    identifyTask.execute(identifyParams);
    showMessage(loadingLabel, true); 
    showStateResults();
                                    }
0 Kudos
WillHughes1
Frequent Contributor
Will,

    If you only want one layer of one particular map service and that is it than you need to look at the identifyFeatures function in the IdentifyWidget.mxml and basically delete all the for loop an just hard code the identifyParams and identify task something like this

private function identifyFeatures():void
   {
    var identifyParams : IdentifyParameters = new IdentifyParameters();
    identifyParams.returnGeometry = false;
    identifyParams.tolerance = identifyTolerance;
    identifyParams.geometry = identifyPoint;
    identifyParams.width = map.width;
    identifyParams.height = map.height;
    identifyParams.mapExtent = map.extent;
    identifyParams.spatialReference = map.spatialReference;
                                                   //You have to know the id number of your layer here
                                                   identifyParams.layerIds = [23];
                                                   var identifyTask:IdentifyTask = new IdentifyTask("http://yourserver/arcgis/yourservice/mapserver);
    identifyTask.addEventListener(IdentifyEvent.EXECUTE_COMPLETE, onResult);
    identifyTask.addEventListener(FaultEvent.FAULT, onFault);
    identifyTask.execute(identifyParams);
    showMessage(loadingLabel, true); 
    showStateResults();
                                    }



Robert, That worked perfectly. Thanks a bunch.  Will
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
All,

   Updated version available based on Erwan's and Ernst's suggestions.
0 Kudos
ErwanCaradec
Emerging Contributor
Perfect !
as usual !
0 Kudos
ErnstEijkelenboom
Esri Contributor
Robert,
Thank you for the update!
I try the <zoom2message> tag, but I still see the text "Click to Zoom to Point".

Can you also describe the valid values for <identifylayeroption> in your readme?
Of course you can look in the REST-help (http://<sername>/ArcGIS/SDK/REST/index.html?identify.html), but this is not so easy for non-developers.

The options "top",  "visible:1" or "all:2,4" have strange behaviour when you have more operational mapservices. If you have 2 mapservices, the result of "top" gives you 2 layers back!

Is it possible to keep the focus on the Identify-tool? When you click on the map for an identify, the focus is directly switched back to navigation mode. When you want to identify more than once you need everytime clicking first on the "identify"-button and the the point-button  before you can identify a new location!

I'm missing the InfoWindow during a MouseOver Graphic event. The InfoWindow is only visible with a MouseOver in the Result Window.

Thanks,

Ernst
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Ernst,

    Thanks for the feedback I see my issue with the zoom2message you need to put it inside the lables parent element in the IdentifyWidget.xml. Like this:

             <labels>
  <zoom2message>Test - Click to Zoom to Point</zoom2message>
  <identifylabel>Identify</identifylabel>
  <resultslabel>Results</resultslabel>
  <descriptionlabel>Use the identify tool to identify features on the map:</descriptionlabel>
  <pointlabel>Identify</pointlabel>
  <clearlabel>Clear</clearlabel>
  <loadinglabel>Loading...</loadinglabel>
  <selectionlabel>Features Identified:</selectionlabel>
 </labels>


for the layers options, first you don't need to pay to much attention to the REST Documentation as this is how REST behind the flex api is handling the requests. When the REST API is talking about all:2,4 that is the same as the Flex AGS API senting the IdentifyParameters.layerOption of all and IdentifyParameters.layerIds = [2,4]

The options "top", "visible:1" or "all:2,4" have strange behaviour when you have more operational mapservices. If you have 2 mapservices, the result of "top" gives you 2 layers back!


This is actually the expected behavior as an identify task is exectuted for each map service in your map so "top" will return the top layer for each map service or operational layer in your map.

As far as the keeping the identify tool active after the initial identify all you need to do is add activateIdentifyTool(); in to the drawEnd function. I will add an option for this to the config.

For the mousing over the graphic this has never been available for the identify because you need to consider which layer you would display the results for since all the layers are identified using the same exact point. This is just not feasible.
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
All,

   It has been updated again based on comments from Ernst.

Version 2.1.3
0 Kudos
ErnstEijkelenboom
Esri Contributor
Robert,


As far as the keeping the identify tool active after the initial identify all you need to do is add activateIdentifyTool(); in to the drawEnd function. I will add an option for this to the config.

Great! This works fine.



For the mousing over the graphic this has never been available for the identify because you need to consider which layer you would display the results for since all the layers are identified using the same exact point. This is just not feasible.

You're right! I was looking to the search widget. The search widget returns the geometries of the features. This is of course not the case with the identify widget.


I like the 2.1.3 version of your exellent Identify widget.

Thanks,

Ernst.
0 Kudos
KomanDiabate
Deactivated User
Robert, this is a great tool. I like the prefixlink. However, I am also seeing duplicate results. Any answer on this issue? Thanks.
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Koman,

   The only people that are experiencing the issue with doubled results in the identify are people that can not duplicate the same issue using others map services like ESRIs. So you likely have an issue in your map service.
0 Kudos