Identify on FeatureLayer using Coordinates

2451
17
04-26-2011 07:59 AM
by Anonymous User
Not applicable
All of the examples/samples I've seen dealing with FeatureLayers and Identify deal with mouse clicks. Is there a way to do the same with a coordinate passed from, say, an address locator?

Thanks!

rGibson
Tags (2)
0 Kudos
17 Replies
IvanBespalov
Occasional Contributor III
Sorry, but I do not understand why IdentifyTask needed?

1 - FeatureLayer has default MXML property graphicProvider= ArrayCollection of all the graphics currently in the layer. Each of graphics has geometry.
2 - FeatureLayer has public property outFields.
3 - Well - you have array of geometries(graphicProvider) on client side and fields(outFields) on client side. Tell me why new server call(IdentifyTask) needed? Or I'm missing something?

Thanks.
0 Kudos
by Anonymous User
Not applicable
Sorry, but I do not understand why IdentifyTask needed?

1 - FeatureLayer has default MXML property graphicProvider= ArrayCollection of all the graphics currently in the layer. Each of graphics has geometry.
2 - FeatureLayer has public property outFields.
3 - Well - you have array of geometries(graphicProvider) on client side and fields(outFields) on client side. Tell me why new server call(IdentifyTask) needed? Or I'm missing something?

Thanks.


Hi, Ivan.

Desire is to use point coordinates from address locator to perform point-in-polygon analysis. IdentityTask is the only way I am familiar with.
0 Kudos
by Anonymous User
Not applicable
Sorry, but I do not understand why IdentifyTask needed?

1 - FeatureLayer has default MXML property graphicProvider= ArrayCollection of all the graphics currently in the layer. Each of graphics has geometry.
2 - FeatureLayer has public property outFields.
3 - Well - you have array of geometries(graphicProvider) on client side and fields(outFields) on client side. Tell me why new server call(IdentifyTask) needed? Or I'm missing something?

Thanks.


I might also add that the need is to simultaneously perform the identify/query on multiple polygon layers using the same coordinates. Possibly as many as 20. I've done this successfully using MapServices. Just trying it with FeatureService.
0 Kudos
IvanBespalov
Occasional Contributor III
OK, if I need to
Identify on FeatureLayer using Coordinates
, and this layer is <esri:Map /> child i do not make any calls to ArcGIS server, because FeatureLayer is the result of query and has all needed geometries and fields on client side. I'll just filter and sort it as I need:
for each (var gr:Graphic in featureLayer.graphicProvider)
{
    // find geometry and get fields
}


If I
Just trying it with FeatureService
not included in <esri:Map /> MXML tag. I call to server with new query.

MapServer - look for Supported Operations
FeatureServer - look for Supported Operations

Anywhere good luck.
0 Kudos
by Anonymous User
Not applicable
Why an identifyTask? Because I could be querying as many as 20 separate layers and sorting through as many as 100 fields. In the app I query various polygon layers contained in MapServices dynamically based on the coordinate of an address, pulling just those values I need for the report to the user. Placing the FeatureLayer inside the Map tag would require listing everyone of those fields I would potentially need to query in the Outfields, correct?

So what I'm hearing is that you cannot (or shouldn't) place the URL of a FeatureService in the identifyTask MXML tag, correct?

r
0 Kudos
IvanBespalov
Occasional Contributor III
Placing the FeatureLayer inside the Map tag would require listing everyone of those fields I would potentially need to query in the Outfields, correct?


Yes. The same as if you make a QueryTask call to FeatureService.

So what I'm hearing is that you cannot (or shouldn't) place the URL of a FeatureService in the identifyTask MXML tag, correct?


No. May be because my English is too bad, I did not understand your post question.

1 - My mistake. Identify on FeatureLayer in your post header for "ArcGIS API for Flex" confused me. I think what you are talking about com.esri.ags.layers.FeatureLayer.

2 - FeatureService (//server/ArcGIS/rest/services/name/FeatureServer/layerID) Supported Operations are "Query" "Add Features" "Update Features" "Delete Features" "Apply Edits". No Identify supported.

Good luck.
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Russell,

   Here is a snippet of code from my Identify widget that shows how I handle FeatureService. The important part of the code is where I create a mapservice url from the featureservice url, most of the other stuff is specific to me determining which layers are visible.

if (layer is FeatureLayer)
     {
      var featLayer:FeatureLayer = layer as FeatureLayer;
      url = featLayer.url;
      var layId:int = -1;
      var arcDL:ArcGISDynamicMapServiceLayer;
      
      if( url.indexOf("FeatureServer") > -1)
      {
       var msName:String = url.replace("FeatureServer","MapServer");
       arcDL = new ArcGISDynamicMapServiceLayer(msName.substring(0,msName.lastIndexOf("/")));
       url = arcDL.url;
       layId = parseInt(msName.substring(msName.lastIndexOf("/")+ 1));
      }else{
       arcDL = new ArcGISDynamicMapServiceLayer(url.substring(0,url.lastIndexOf("/")));
       layId = parseInt(url.substring(url.lastIndexOf("/")+ 1));
       url = arcDL.url;
      }
      
      if(identifyLayerOption == "visible")
      {
       if(layId != -1)
        identifyParams.layerIds = [layId];
       if(featLayer.visible == false)
        url="";
      }
     }
0 Kudos
by Anonymous User
Not applicable
First off, many thanks to Robert and Ivan for their efforts and patience. You guys are a real asset.

Here's what I found and it's actually due to a bug (NIM033079).....

When running an identifyTask on a FeatureService, the identifyTask will fail on non-visible layers. Oddly enough there is no problem doing the same with a garden-variety MapService. So in my code in the identifyParams setup I was using identifyParams.layerOption = IdentifyParameters.LAYER_OPTION_ALL. This was causing the issue. So according to ESRI, the work-around is to specify the layerOption as "top" or just do not specify any layer option.

Again, thanks for everyone's help.

Russell
0 Kudos