<?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:esri="http://www.esri.com/2008/ags"> <fx:Script> <![CDATA[ import com.esri.ags.events.ImageServiceIdentifyEvent; import com.esri.ags.events.MapMouseEvent; import com.esri.ags.geometry.Geometry; import com.esri.ags.tasks.supportClasses.ImageServiceIdentifyParameters; import com.esri.ags.tasks.supportClasses.ImageServiceIdentifyResult; import mx.controls.Text; import mx.rpc.AsyncResponder; private function onMapClick(event:MapMouseEvent):void { imgIdentifyTask.url = "http://myservername/ArcGIS/rest/services/test4/ImageServer"; var IDParams:ImageServiceIdentifyParameters = new ImageServiceIdentifyParameters(); IDParams.geometry = event.mapPoint; imgIdentifyTask.execute(IDParams); } private function imgExecuteComplete(event:ImageServiceIdentifyEvent):void { var pixelValue:Label = event.identifyResult.value as Label idImageLabel.addChild(pixelValue); } ]]> </fx:Script> <fx:Declarations> <esri:ImageServiceIdentifyTask id="imgIdentifyTask" executeComplete="imgExecuteComplete(event)"/> </fx:Declarations> <esri:Map id="myMap" extent="{new Extent(-10955781, 4374995, -8825382, 5549067)}" mapClick="onMapClick(event)" openHandCursorVisible="false"> <esri:ArcGISTiledMapServiceLayer url="http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer"/> <esri:ArcGISImageServiceLayer url="http://myservername/ArcGIS/rest/services/test4/ImageServer"/> </esri:Map> <s:Label id="idImageLabel" text="{}" x="80" y="50" width="150"/> </s:Application>
<?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:esri="http://www.esri.com/2008/ags" xmlns:mx="library://ns.adobe.com/flex/mx"> <fx:Script> <![CDATA[ import com.esri.ags.events.ImageServiceIdentifyEvent; import com.esri.ags.events.MapMouseEvent; import com.esri.ags.geometry.Geometry; import com.esri.ags.tasks.supportClasses.ImageServiceIdentifyParameters; import com.esri.ags.tasks.supportClasses.ImageServiceIdentifyResult; import mx.controls.Label; import mx.controls.Text; import mx.core.IUIComponent; import mx.rpc.AsyncResponder; private function onMapClick(event:MapMouseEvent):void { imgIdentifyTask.url = "http://yourservername/ArcGIS/rest/services/FlexDev/lf_mosaic/ImageServer"; var IDParams:ImageServiceIdentifyParameters = new ImageServiceIdentifyParameters(); IDParams.geometry = event.mapPoint; imgIdentifyTask.execute(IDParams); } private function imgExecuteComplete(event:ImageServiceIdentifyEvent):void { var pixelValue:Array = event.identifyResult.properties.Values as Array; idImageLabel.text = pixelValue.toString(); } ]]> </fx:Script> <fx:Declarations> <esri:ImageServiceIdentifyTask id="imgIdentifyTask" executeComplete="imgExecuteComplete(event)"/> </fx:Declarations> <esri:Map id="myMap" extent="{new Extent(-10955781, 4374995, -8825382, 5549067)}" openHandCursorVisible="false" mapClick="onMapClick(event)"> <esri:ArcGISTiledMapServiceLayer url="http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer"/> <esri:ArcGISImageServiceLayer url="http://yourservername/ArcGIS/rest/services/FlexDev/lf_mosaic/ImageServer"/> </esri:Map> <s:HGroup x="80" y="50" width="150" color="#245EEE"> <s:Label id="idImageLabel" text="PIXEL VALUES FROM CLICK" fontWeight="bold" fontSize="24" color="#000000"/> </s:HGroup> </s:Application>
If anyone cares and for sake of posterity, I have this working on a rudimentary level. I still need to format the output, but I am getting pixels values. What I had to do is set up a Mosaic Dataset in a geodatabase. In my case I added two rasters that overlay each other. I then set up a Image Service in ArcGIS Server 10 that published the Mosaic Dataset. I used all the defaults, except the option of "Allowed compression methods", I unchecked JPEG. And used the code below.
DISCLAIMER: Don't use this for displaying overlaying rasters. I would stick with publishing individual Raster Datasets.<?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:esri="http://www.esri.com/2008/ags" xmlns:mx="library://ns.adobe.com/flex/mx"> <fx:Script> <![CDATA[ import com.esri.ags.events.ImageServiceIdentifyEvent; import com.esri.ags.events.MapMouseEvent; import com.esri.ags.geometry.Geometry; import com.esri.ags.tasks.supportClasses.ImageServiceIdentifyParameters; import com.esri.ags.tasks.supportClasses.ImageServiceIdentifyResult; import mx.controls.Label; import mx.controls.Text; import mx.core.IUIComponent; import mx.rpc.AsyncResponder; private function onMapClick(event:MapMouseEvent):void { imgIdentifyTask.url = "http://yourservername/ArcGIS/rest/services/FlexDev/lf_mosaic/ImageServer"; var IDParams:ImageServiceIdentifyParameters = new ImageServiceIdentifyParameters(); IDParams.geometry = event.mapPoint; imgIdentifyTask.execute(IDParams); } private function imgExecuteComplete(event:ImageServiceIdentifyEvent):void { var pixelValue:Array = event.identifyResult.properties.Values as Array; idImageLabel.text = pixelValue.toString(); } ]]> </fx:Script> <fx:Declarations> <esri:ImageServiceIdentifyTask id="imgIdentifyTask" executeComplete="imgExecuteComplete(event)"/> </fx:Declarations> <esri:Map id="myMap" extent="{new Extent(-10955781, 4374995, -8825382, 5549067)}" openHandCursorVisible="false" mapClick="onMapClick(event)"> <esri:ArcGISTiledMapServiceLayer url="http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer"/> <esri:ArcGISImageServiceLayer url="http://yourservername/ArcGIS/rest/services/FlexDev/lf_mosaic/ImageServer"/> </esri:Map> <s:HGroup x="80" y="50" width="150" color="#245EEE"> <s:Label id="idImageLabel" text="PIXEL VALUES FROM CLICK" fontWeight="bold" fontSize="24" color="#000000"/> </s:HGroup> </s:Application>