Tuesday, October 16, 2007

Hey ArcGIS users

You can create an ArcGIS Server based layer using the AWX Flex API. In the below sample, I'm loading a layer from a specified endpoint and then when I click click on the button, I'm turning off the "water" layer in the ArcGIS group layer.

<?xml version="1.0" encoding="utf-8"?>
<mx:Application
xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:framework="com.esri.aws.osgi.framework.*"
xmlns:map="com.esri.aws.awx.map.*"
xmlns:layers="com.esri.aws.awx.map.layers.*"
layout="absolute"
>
<mx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
import mx.collections.ItemResponder;
import com.esri.aws.awx.map.layers.LayerVisibility;
private function turnWaterOff() : void
{
ags.getLayerVisibilities( new ItemResponder(
function(data : Object, token : Object = null) : void {
var arrCol : ArrayCollection = data as ArrayCollection;
for each ( var layerVisibility : LayerVisibility in arrCol)
{
if( layerVisibility.name == "Water")
{
layerVisibility.visible = false;
}
}
},
function(info : Object, token : Object = null) : void {
trace( info );
}
));
}
]]>
</mx:Script>
<framework:Framework apiKey="196405023"/>
<mx:Panel width="100%" height="100%">
<map:Map>
<map:basemaps>
<layers:ArcGISMapServerGroupLayer id="ags"
endpointURI="http://host/arcgis/services/MapService/MapServer"
/>
</map:basemaps>
</map:Map>
<mx:ControlBar>
<mx:Button label="Turn Water Off" click="turnWaterOff()"/>
</mx:ControlBar>
</mx:Panel>
</mx:Application>

7 comments:

Danny said...

Does anything special need to be done to make this work on the ArcGIS Server side? I'm trying to do this based upon your example but the data object is always empty (0 length).

thunderhead said...

Yes - in the current version we only support visibility on the top group layer :-(

Unknown said...

I would like to use AWX as my front end to ArcGis Server. However, the performance in using the ArcGISserver grouplayer is slow for a complex mxd. Can you subclass the RasterTileLayer to use an ArcGis Server tile cache? If so can you get us started in the right direction on this. Thanks

CMH

Unknown said...

I have the ArcGIS and Flex setup working but not sure why the map is not being loaded from the cache. I have created a cache and have also loaded the same service as a java war file. When its loaded as the Java Application i can see the map as tiles but not when i make call from within the Flash palyer. I am making SOAP calls to the ArcGIS Maop Services by using

awx:ArcGISMapServerGroupLayer endpointURI="Some URL".

Thanks !!!

Jason Harris said...

Figure out that cache issue? I am running into the same thing....It doesnt seem to be using the cache.

thunderhead said...

Correct - in the current version, there is _only_ support for MapImage and it has to have a geographic projection.

Jason Harris said...

.."in the current version"...

Of course, that last comment leads me to believe that there is something in the works...can to let something leak out?