Select to view content in your preferred language

is esr:FeatureLayer not supported by esri:ArcGISDynamicMapServiceLayer???

597
1
04-01-2011 04:30 AM
VikramTripathi
Deactivated User
Dear All
m facing a problem related to feature layers. we have only esri:ArcGISDynamicMapServiceLayer for our application. and i want to select a layer where mouse get clicked. means on the map where ever i clicked by mouse it shows that layer inormation by <esri:infoWindowRenderer> tag. but problem is that when i use <esri:ArcGISTiledMapServiceLayer/> my code work fine, but as per our resources we have only dynaminMapServiceLayer, so i hv to work with dynaminMapServiceLayer. so when i remove <esri:ArcGISTiledMapServiceLayer/> tag, then my code does not working....



<?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"
      height="100%" width="100%"
      creationComplete="populateDistricts()"
      xmlns:esri="http://www.esri.com/2008/ags"
      xmlns:ns1="com.nic.gis.flexi.nicComponents.*"
      pageTitle="NIC Map Demo"
      backgroundColor="#D5F2F9"
      >

<fx:Style>
  @namespace mapInfoWindow "com.nic.gis.flexi.designer.css.nicmapInfoWindow";
  global
  {
   chrome-color: #76C5F2;
   content-background-color: #9BE5F8;
  }
 
</fx:Style>
<fx:Style source="com/nic/gis/flexi/designer/css/nicMap.css"/>
<!--<fx:Script source="com/nic/gis/flexi/designer/scripts/Classes.as"/>-->
<fx:Script>
  <![CDATA[
   import com.nic.gis.flexi.nicComponents2.switchLocation;
  
   import mx.events.FlexEvent;
   import mx.managers.PopUpManager;
  
   public var nicDynamicMapService:String="http://10.131.2.64:8080/GeoServiceRest/services/VidishaGoogleMap/MapServer";
   public var nicFeatureLayer:String="http://10.131.2.64:8080/GeoServiceRest/services/VidishaGoogleMap/MapServer/2";
   public var nicFeatureLayerLake:String="http://10.131.2.64:8080/GeoServiceRest/services/VidishaGoogleMap/MapServer/6";
  
   private var arcGISTopoWorldMap:String="http://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer";
   private var bingDemographicMap:String="http://services.arcgisonline.com/ArcGIS/rest/services/Demographics/USA_1990-2000_Population_Change/M...";
   private var googleDemographicMap:String="http://services.arcgisonline.com/ArcGIS/rest/services/Demographics/USA_1990-2000_Population_Change/M...";
  
   private var backGroundTiledMap:String=arcGISTopoWorldMap;
   public var isEnabledVbox:Boolean=true;
   [Bindable]
   [Embed(source="com/nic/gis/flexi/designer/images/cursorsIcons/road_sign.png")]
   private var roadIcon:Class;
  
   [Bindable]
   [Embed(source="com/nic/gis/flexi/designer/images/cursorsIcons/cursor_arrow.png")]
   private var curArrow:Class;
  
   private var roadIconId:int;
   protected function roadLayerHandler(event:MouseEvent):void
   {
    //Alert.show("Clicked Road");
   }
   protected function lakeLayerHandler(event:MouseEvent):void
   {
    Alert.show("Clicked on Lake");
   }
  
  
   protected function featureLayer_mouseOverHandler(event:MouseEvent):void
   {
    var visibleLayers:ArrayCollection = this.dynServLyr.visibleLayers;
    //Alert.show(visibleLayers.getItemIndex(2)+'');
    if(visibleLayers.getItemIndex(2)!= -1){
     cursorManager.setCursor(roadIcon);
     isEnabledVbox=true;
    
    
    }else{
    
    }
   }
  
  
   protected function featureLayer_mouseOutHandler(event:MouseEvent):void
   {
    cursorManager.removeAllCursors();
   }
  
  
   protected function featureLayerLake_mouseOverHandler(event:MouseEvent):void
   {
    // TODO Auto-generated method stub  curArrow
    cursorManager.setCursor(curArrow);
   }

   protected function button1_clickHandler(event:MouseEvent):void
   {
     import mx.managers.PopUpManager;
     var newLocation:switchLocation=new switchLocation();
     PopUpManager.addPopUp(newLocation,this,false);
     newLocation.move(415, 65);
   }

  ]]>
</fx:Script>


<fx:Script source="com/nic/gis/flexi/designer/scripts/PopulateData.as"/>
<fx:Script source="com/nic/gis/flexi/designer/scripts/NicMapHandler.as"/>

<!--<fx:Script source="com/nic/gis/flexi/customcomponents/Navigation/NavigationSkinHandler.as"/>-->
<fx:Declarations>
  <esri:NavigationTool id="navTool" map="{nicMap}"/>
 
  <!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<s:Button label="Select Blocks" click="button1_clickHandler(event)"/>
<s:Button label="Full Extents" click="{navTool.zoomToFullExtent()}"/>
<esri:Map width="100%" height="609" id="nicMap" openHandCursorVisible="true"
     logoVisible="true" x="0" y="29">
  <esri:extent>
   <!--<esri:Extent xmin="-14000000" ymin="2800000" xmax="-7000000" ymax="6400000">-->
   <esri:Extent xmin="73.58470916748047" ymin="20.695838928222656"
       xmax="83.47240447998047" ymax="27.287635803222656" >
    <!--Extents For Indian MAP
    <esri:Extent xmin="59.88475799560547" ymin="9.566688537597656"
    xmax="99.43553924560547" ymax="35.933876037597656">-->
    <!--<esri:SpatialReference wkid="102100"/>-->
   </esri:Extent>
  </esri:extent>
  <esri:ArcGISTiledMapServiceLayer id="tiledBaseMap"
  url="http://server.arcgisonline.com/arcgis/rest/services/ESRI_StreetMap_World_2D/MapServer"
  visible="true"/>
  <esri:ArcGISDynamicMapServiceLayer id="dynBaseMap"
             url="http://10.131.2.64:8080/GeoServiceRest/services/GeoApproach/MapServer"
             creationComplete="{nicMap.extent=dynBaseMap.fullExtent}"
             visible="true">
   <esri:visibleLayers>
    <s:ArrayCollection>
    
     <fx:Number>19</fx:Number>
    </s:ArrayCollection>
   </esri:visibleLayers>
  </esri:ArcGISDynamicMapServiceLayer>
  <esri:ArcGISDynamicMapServiceLayer id="dynServLyr"
             url="{nicDynamicMapService}"
             load="dynServLyr.defaultVisibleLayers()"
             visible="false"/>
  <esri:GraphicsLayer id="myGraphicsLayer"/>
  <esri:FeatureLayer id="featureLayer"
         outFields="[OBJECTID,DIST_CODE,BLOCK_CODE,R_ID,road_category]"
         selectionColor="0x0008F13"
         url="{nicFeatureLayer}"
         click="roadLayerHandler(event)"
         mouseOver="featureLayer_mouseOverHandler(event)"
         mouseOut="featureLayer_mouseOutHandler(event)">
   <esri:infoWindowRenderer>
    <fx:Component>
     <mx:VBox label="Road Information.."
        click="populateRoadDetails()"
        render="populateRoadDetails()">
      <fx:Script source="com/nic/gis/flexi/designer/scripts/roadInformation.as"/>
      <fx:Script>
       <![CDATA[
        import mx.effects.Rotate;
        import mx.events.FlexEvent;
        [Bindable]
        var imgLoc:String;
       ]]>
      </fx:Script>
     
      <s:Label id="lblPckgNo" text="Package No: Wait.."/>
      <s:Label id="lblDistName" text="District Code: Wait.."/>
      <s:Label id="lblBlockName" text="Block Code: Wait.."/>
      <s:Label id="lblRoadId" text="Road ID: { data.R_ID}" />
      <s:Label id="lblRoadLen" text="Road Length: Wait.."/>
      <mx:LinkButton id="lnkBtnRotateImg"
            label="Rotate Image"
            click="lnkBtnRotateImg_clickHandler(event)"/>
      <mx:Image  id="imgRoad" source="{'com/nic/gis/flexi/designer/roadimages/'+imgLoc+''}"
           mouseOver="imgRoad_mouseOverHandler(event)"
           mouseOut="imgRoad_mouseOutHandler(event)"
           height="150" width="150"/>
      <mx:LinkButton label="PMGSY Profile"
            color="green"
            fontWeight="bold"
            click="getMoreInfo(data.R_ID,'0006','31')"/>
     </mx:VBox>
    </fx:Component>
   </esri:infoWindowRenderer>
   <esri:renderer>
    <esri:UniqueValueRenderer attribute="DIST_CODE">
     <esri:defaultSymbol>
      <esri:SimpleMarkerSymbol color="0xCCCCCC"
             size="12"
             style="x"/>
     </esri:defaultSymbol>
     <esri:UniqueValueInfo  id="uniqueValue" >
      <esri:symbol>
       <esri:CompositeSymbol>
        <esri:SimpleMarkerSymbol style="square" size="2" color="0x0008F13" alpha="0.0"/>
       </esri:CompositeSymbol>
      </esri:symbol>
     </esri:UniqueValueInfo>
    </esri:UniqueValueRenderer>
   </esri:renderer>
  </esri:FeatureLayer>
</esri:Map>
</s:Application>
Tags (2)
0 Kudos
1 Reply
HeatherGonzago
Esri Contributor
Just some basic troubleshooting...
Are you getting any specific error messages?
Also what happens if you replace your services with the sample services on ArcGISOnline?
http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/
0 Kudos