GraphicLayer not displaying resulting FeatureSet

552
3
11-16-2010 11:39 AM
RickBaker
New Contributor
I am attempting to display the results of my featureset in the GraphicsLayer but nothing is displaying. I know the query is working because of the count on the features in the resulting featureset.

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
 xmlns:s="library://ns.adobe.com/flex/spark" 
 xmlns:mx="library://ns.adobe.com/flex/mx"
 xmlns:esri="http://www.esri.com/2008/ags"
 pageTitle="Salt Lake County Recorder">
 
 <s:layout>
  <s:VerticalLayout gap="10"
   horizontalAlign="center"
   paddingBottom="20"
   paddingLeft="25"
   paddingRight="25"
   paddingTop="20"/>
 </s:layout>
 
 <fx:Script>
 <![CDATA[
  import com.esri.ags.Graphic;
  import com.esri.ags.FeatureSet;
  import mx.controls.Alert;
  import mx.rpc.AsyncResponder;
  
   private function doQuery():void
  {
   queryTask.execute(query, new AsyncResponder(onResult, onFault));
   
   function onResult(featureSet:FeatureSet, token:Object = null):void
   {
    // No code needed in this simple sample, since the
    // graphiclayer is bound to the query result using
    // graphicProvider="{queryTask.executeLastResult.features}"
       }
   function onFault(info:Object, token:Object = null):void
   {
    Alert.show(info.toString(), "Query Problem");
   }
  }
 ]]>
 </fx:Script>[/INDENT] 
 <fx:Declarations>
  <esri:QueryTask id="queryTask"
   showBusyCursor="true"
   url="http://<mydataurl>/MapServer/4"
   useAMF="false" />
  <esri:Query id="query"
   outSpatialReference="{myMap.spatialReference}"
   returnGeometry="true"
   where="PARCEL like '%{qText.text}%'">
   
  <!--<esri:Query id="query"
   outSpatialReference="{myMap.spatialReference}"
   returnGeometry="true"
   text="{qText.text}">
   -->
   <!--where="PARCEL like '0827131011%'"-->
   <!---->
   
  </esri:Query>
  <esri:InfoSymbol id="infoSymbol1">
   <esri:infoRenderer>
    <fx:Component>
     <mx:VBox>
      <mx:Label text="{data.PARCEL}" />
      <mx:Label text="{data.own_name}" />
     </mx:VBox>
    </fx:Component>
   </esri:infoRenderer>
  </esri:InfoSymbol>
 </fx:Declarations>
 
 <s:Panel 
  height="60" 
  title="Query a layer (search parcel number)" 
  backgroundColor="#ECE7E7">
  <s:layout>
   <s:HorizontalLayout/>
  </s:layout>
  <s:TextInput id="qText"
   enter="doQuery()"
   text="0827131011" 
   width="100%"/>
  <s:Button click="doQuery()" label="Do Query" />
 </s:Panel>
 
 <esri:Map id="myMap" >
  <esri:ArcGISDynamicMapServiceLayer url="http://<mydataurl>/MapServer" />
  <!--<esri:GraphicsLayer id="myGraphicsLayer" symbol="{infoSymbol1}" />-->
  <esri:GraphicsLayer id="myGraphicsLayer" symbol="{infoSymbol1}" graphicProvider="{queryTask.executeLastResult.features}" />
 </esri:Map> 
</s:Application>
Tags (2)
0 Kudos
3 Replies
DasaPaddock
Esri Regular Contributor
What happens if you don't set myGraphicsLayer's symbol? Can you also double-check that the layer's shape field is published so that the geometry is being returned?
0 Kudos
RickBaker
New Contributor
Yes, that worked! I removed the GraphicsLayer symbol setting and now I see the graphic layer displayed in the apparent default symbol. Apparently something wrong with my "infoSymbol1" definition??

thanks for the help,
Rick
0 Kudos
DasaPaddock
Esri Regular Contributor
The InfoSymbol only works with point data. Are you returning polygons?
http://help.arcgis.com/en/webapi/flex/apiref/com/esri/ags/symbols/InfoSymbol.html
0 Kudos