Wednesday, August 29, 2007

How to get a layer visibility info ?


<?xml version="1.0" encoding="utf-8"?>
<mx:Application
xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:awx="com.esri.aws.awx.*"
xmlns:map="com.esri.aws.awx.map.*"
xmlns:layers="com.esri.aws.awx.map.layers.*"
xmlns:framework="com.esri.aws.osgi.framework.*"
xmlns:services="com.esri.aws.services.*"
layout="absolute"
>
<mx:Script>
<![CDATA[
import com.esri.aws.awx.map.layers.LayerVisibility;
import mx.collections.ItemResponder;
private function onFrameworkStart() : void
{
parcels.getLayerVisibilities( new ItemResponder(
function(data:Object, token:Object = null):void
{
for each ( var layerVisibility : LayerVisibility in data )
{
trace( layerVisibility.name + " " + layerVisibility.visible);
}
},
function(info:Object, token:Object = null):void
{
trace(info);
}
));
}
]]>
</mx:Script>
<framework:Framework
apiKey="19640523"
frameworkStart="onFrameworkStart()"/>
<map:Map>
<map:basemaps>
<layers:VectorGroupLayer id="parcels"
dataSource="ArcWeb:BR.Parcels.US"
autoLoadLayerVisibilities="false"/>
</map:basemaps>
</map:Map>
</mx:Application>

Friday, August 24, 2007

BTW...Hello and welcome to my blog

My name is Mansour Raad. I'm the senior software architect for ESRI ArcWeb Services. In addition, I'm the resident Adobe Flex evangelist. So...this series of blogs is about tips and tricks on how to use ArcWebExplorer (in beta as of this writing). you can download the swc and check out samples from http://www.arcwebservices.com/v2006/labs/awx2_lab.do.
Have fun and stay tuned.

How to get parcel information ?


<?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:services="com.esri.aws.services.*"
xmlns:map="com.esri.aws.awx.map.*"
xmlns:layers="com.esri.aws.awx.map.layers.*"
layout="absolute"
>
<mx:Script>
<![CDATA[
import com.esri.aws.services.SpatialQueryOptions;
import com.esri.aws.services.ISpatialQuery;
import com.esri.aws.services.PlaceFinderOptions;
import mx.collections.ItemResponder;
import com.esri.aws.services.IPlaceFinder;
import flash.utils.getQualifiedClassName;
import com.esri.aws.osgi.framework.IServiceReference;
private function doSpatialQuery() : void
{
var ref : IServiceReference = framework.systemContext.getServiceReference(getQualifiedClassName(ISpatialQuery));
var spatialQuery : ISpatialQuery = framework.systemContext.getService( ref ) as ISpatialQuery;
var point : Point = new Point(map.centerLon, map.centerLat);
var spatialQueryOptions : SpatialQueryOptions = new SpatialQueryOptions();
spatialQueryOptions.dataSource = "ArcWeb:BR.DetailedParcels.CA";
spatialQuery.findFeaturesByPoint( point, spatialQueryOptions, new ItemResponder(
function( data : Object, token : Object = null ) : void
{
trace( data );
},
function( info : Object, token : Object = null ) : void
{
trace( info );
}
));
}
]]>
</mx:Script>
<framework:Framework id="framework" apiKey="19640523">
<services:SpatialQueryActivator/>
</framework:Framework>
<mx:Panel width="100%" height="100%">
<map:Map id="map">
<map:basemaps>
<layers:VectorGroupLayer id="parcels" dataSource="ArcWeb:BR.Parcels.US" autoLoadLayerVisibilities="false"/>
</map:basemaps>
</map:Map>
<mx:ControlBar>
<mx:Button label="Find Parcel" click="doSpatialQuery()"/>
</mx:ControlBar>
</mx:Panel>
</mx:Application>