Select to view content in your preferred language

Popup or infowindow in a image service?

1962
1
Jump to solution
04-22-2014 12:56 PM
ionarawilson1
Deactivated User
Is it possible to create a popup or infowindow for a image service? Thanks
Tags (2)
0 Kudos
1 Solution

Accepted Solutions
ionarawilson1
Deactivated User
I was able to create a popup for a map service that has an image that contain attribute fields. Yay!
By the way, I was able to create a popup for an image service but I could only query the info from the catalog, not the attributes. Publishing the image as a map service allowed me to get the attributes!
Here is the code if anybody needs it:

<?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 Surveyor"        xmlns:flexScript="flexScript.*"       preloaderChromeColor="#F9F6F6"        backgroundColor="#F7F4F4">   <fx:Script>   <![CDATA[       import com.esri.ags.geometry.MapPoint;    import com.esri.ags.Graphic;    import com.esri.ags.events.QueryEvent;        import com.esri.ags.events.IdentifyEvent;    import mx.controls.Alert;    import mx.rpc.AsyncResponder;    import mx.rpc.Fault;    import com.esri.ags.FeatureSet;    import com.esri.ags.Graphic;    import com.esri.ags.events.MapMouseEvent;    import com.esri.ags.geometry.Extent;    import com.esri.ags.geometry.Geometry;    import com.esri.ags.geometry.MapPoint;    import com.esri.ags.geometry.Polygon;    import com.esri.ags.geometry.Polyline;    import com.esri.ags.symbols.InfoSymbol;    import com.esri.ags.tasks.supportClasses.IdentifyParameters;    import com.esri.ags.tasks.supportClasses.IdentifyResult;         private function onMapClick(event:MouseEvent):void    {     // init indentify parameters       var identifyParams:IdentifyParameters = new IdentifyParameters();     identifyParams.geometry = map.toMapFromStage(event.stageX, event.stageY);     identifyParams.layerOption = IdentifyParameters.LAYER_OPTION_VISIBLE;     identifyParams.returnGeometry = true;     identifyParams.tolerance = 3;     identifyParams.width = map.width;     identifyParams.height = map.height;        identifyParams.mapExtent = map.extent;     identifyParams.spatialReference = map.spatialReference;          identifyTask.execute( identifyParams, new AsyncResponder( onIdentifyComplete, onIdentifyFault ));    }        private function onIdentifyComplete( event:Object, token:Object=null):void    {     graphicsLayer.clear();          if ( event.length > 0 )      {      // take first result      var graphic:Graphic = event[0].feature;                var name:String = graphic.attributes.MUKEY;      var siteindexwa:String = graphic.attributes.siteindexwa;      var siteindexmvwa:String = graphic.attributes.siteindexmvwa;            var content:String = "Name : " + name + "\n";      content += "Site Index WA : " + siteindexwa + "\n";      content += "Site Index mvwa:" + siteindexmvwa            var mapPoint:MapPoint = graphic.geometry as MapPoint;            var myInfoPopup:MyInfoPopup = new MyInfoPopup();      myInfoPopup.content = content;            map.infoWindow.label = "Soils Information";      map.infoWindow.content = myInfoPopup;      map.infoWindow.show( mapPoint );                  // -- OR --            // loop thru entire result set...      //             for each( var result:IdentifyResult in event )      //             {      //              var graphic:Graphic = result.feature;       //             }     }    }        private function onIdentifyFault( event:Fault, token:Object=null ):void    {     Alert.show( event.toString() );    }                   ]]>  </fx:Script>  <fx:Declarations>  <esri:IdentifyTask id="identifyTask" url="http://tfsgis-iisd01:6080/arcgis/rest/services/Fernando/SoilsRaster/MapServer" />  <esri:IdentifyParameters id="identifyParams" />     <esri:SimpleMarkerSymbol id="symbol" color="0xCCCCEE" size="20" alpha="1" style="circle">   <esri:SimpleLineSymbol color="0x0000FF" width="4" alpha="1" style="solid" />  </esri:SimpleMarkerSymbol>  </fx:Declarations>  <esri:Map id="map" click="onMapClick(event)">   <esri:extent>    <esri:Extent xmax="-9438000 " xmin="-12363000" ymax="4500000" ymin="2930000"/>   </esri:extent>           <esri:ArcGISTiledMapServiceLayer url="http://server.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Base/MapServer"/>    <esri:GraphicsLayer id="graphicsLayer"/>   <esri:ArcGISDynamicMapServiceLayer    url="http://tfsgis-iisd01:6080/arcgis/rest/services/Fernando/SoilsRaster/MapServer"/>      </esri:Map> </s:Application>

And the component:
<?xml version="1.0" encoding="utf-8"?> <mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml">  <mx:Script>   <![CDATA[    [Bindable]    public var content:String;   ]]>  </mx:Script>  <mx:VBox width="100%" height="100%" backgroundColor="0xEEEEEE">   <mx:Text text="{content}"/>  </mx:VBox> </mx:Canvas>

View solution in original post

0 Kudos
1 Reply
ionarawilson1
Deactivated User
I was able to create a popup for a map service that has an image that contain attribute fields. Yay!
By the way, I was able to create a popup for an image service but I could only query the info from the catalog, not the attributes. Publishing the image as a map service allowed me to get the attributes!
Here is the code if anybody needs it:

<?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 Surveyor"        xmlns:flexScript="flexScript.*"       preloaderChromeColor="#F9F6F6"        backgroundColor="#F7F4F4">   <fx:Script>   <![CDATA[       import com.esri.ags.geometry.MapPoint;    import com.esri.ags.Graphic;    import com.esri.ags.events.QueryEvent;        import com.esri.ags.events.IdentifyEvent;    import mx.controls.Alert;    import mx.rpc.AsyncResponder;    import mx.rpc.Fault;    import com.esri.ags.FeatureSet;    import com.esri.ags.Graphic;    import com.esri.ags.events.MapMouseEvent;    import com.esri.ags.geometry.Extent;    import com.esri.ags.geometry.Geometry;    import com.esri.ags.geometry.MapPoint;    import com.esri.ags.geometry.Polygon;    import com.esri.ags.geometry.Polyline;    import com.esri.ags.symbols.InfoSymbol;    import com.esri.ags.tasks.supportClasses.IdentifyParameters;    import com.esri.ags.tasks.supportClasses.IdentifyResult;         private function onMapClick(event:MouseEvent):void    {     // init indentify parameters       var identifyParams:IdentifyParameters = new IdentifyParameters();     identifyParams.geometry = map.toMapFromStage(event.stageX, event.stageY);     identifyParams.layerOption = IdentifyParameters.LAYER_OPTION_VISIBLE;     identifyParams.returnGeometry = true;     identifyParams.tolerance = 3;     identifyParams.width = map.width;     identifyParams.height = map.height;        identifyParams.mapExtent = map.extent;     identifyParams.spatialReference = map.spatialReference;          identifyTask.execute( identifyParams, new AsyncResponder( onIdentifyComplete, onIdentifyFault ));    }        private function onIdentifyComplete( event:Object, token:Object=null):void    {     graphicsLayer.clear();          if ( event.length > 0 )      {      // take first result      var graphic:Graphic = event[0].feature;                var name:String = graphic.attributes.MUKEY;      var siteindexwa:String = graphic.attributes.siteindexwa;      var siteindexmvwa:String = graphic.attributes.siteindexmvwa;            var content:String = "Name : " + name + "\n";      content += "Site Index WA : " + siteindexwa + "\n";      content += "Site Index mvwa:" + siteindexmvwa            var mapPoint:MapPoint = graphic.geometry as MapPoint;            var myInfoPopup:MyInfoPopup = new MyInfoPopup();      myInfoPopup.content = content;            map.infoWindow.label = "Soils Information";      map.infoWindow.content = myInfoPopup;      map.infoWindow.show( mapPoint );                  // -- OR --            // loop thru entire result set...      //             for each( var result:IdentifyResult in event )      //             {      //              var graphic:Graphic = result.feature;       //             }     }    }        private function onIdentifyFault( event:Fault, token:Object=null ):void    {     Alert.show( event.toString() );    }                   ]]>  </fx:Script>  <fx:Declarations>  <esri:IdentifyTask id="identifyTask" url="http://tfsgis-iisd01:6080/arcgis/rest/services/Fernando/SoilsRaster/MapServer" />  <esri:IdentifyParameters id="identifyParams" />     <esri:SimpleMarkerSymbol id="symbol" color="0xCCCCEE" size="20" alpha="1" style="circle">   <esri:SimpleLineSymbol color="0x0000FF" width="4" alpha="1" style="solid" />  </esri:SimpleMarkerSymbol>  </fx:Declarations>  <esri:Map id="map" click="onMapClick(event)">   <esri:extent>    <esri:Extent xmax="-9438000 " xmin="-12363000" ymax="4500000" ymin="2930000"/>   </esri:extent>           <esri:ArcGISTiledMapServiceLayer url="http://server.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Base/MapServer"/>    <esri:GraphicsLayer id="graphicsLayer"/>   <esri:ArcGISDynamicMapServiceLayer    url="http://tfsgis-iisd01:6080/arcgis/rest/services/Fernando/SoilsRaster/MapServer"/>      </esri:Map> </s:Application>

And the component:
<?xml version="1.0" encoding="utf-8"?> <mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml">  <mx:Script>   <![CDATA[    [Bindable]    public var content:String;   ]]>  </mx:Script>  <mx:VBox width="100%" height="100%" backgroundColor="0xEEEEEE">   <mx:Text text="{content}"/>  </mx:VBox> </mx:Canvas>
0 Kudos