Packagecom.esri.aws.services
Interfacepublic interface ISpatialQuery

Perform query and proximity searches, such as "find nearest", "find within a distance", and "tell me about this area" on ArcWeb Services Spatial Query data sources. Search for all points of interest within a given distance of a point or line, for example, find all museums within five miles of the Eiffel Tower, or create a search to find the three museums closest to the Eiffel Tower. Based on ArcWeb Services Spatial Query web service.

ISpatialQuery supports all Spatial Query data sources (as opposed to QueryGroupLayer which only supports point data sources). Note that geometry is only returned for point data sources.

Requires SpatialQueryActivator in Framework.

View the examples.

See also

SpatialQueryActivator
http://www.arcwebservices.com/v2006/capabilities/spatial_query.do


Public Methods
 MethodDefined by
  
findFeaturesByExtent(extent:Envelope, spatialQueryOptions:SpatialQueryOptions, responder:IResponder):void
findFeaturesByExtent is used to retrieve features from an ArcWeb Services Spatial Query data source.
ISpatialQuery
  
findFeaturesByPoint(center:GeoPoint, spatialQueryOptions:SpatialQueryOptions, responder:IResponder):void
findFeaturesByPoint is used to retrieve features from an ArcWeb Services Spatial Query data source.
ISpatialQuery
Method detail
findFeaturesByExtent()method
public function findFeaturesByExtent(extent:Envelope, spatialQueryOptions:SpatialQueryOptions, responder:IResponder):void

findFeaturesByExtent is used to retrieve features from an ArcWeb Services Spatial Query data source.

Parameters
extent:Envelope — The Envelope value of the requested extent
 
spatialQueryOptions:SpatialQueryOptions — The object containing all of the search options
 
responder:IResponder — The user defined IResponder object to be called upon SOAP response

See also

findFeaturesByPoint()method 
public function findFeaturesByPoint(center:GeoPoint, spatialQueryOptions:SpatialQueryOptions, responder:IResponder):void

findFeaturesByPoint is used to retrieve features from an ArcWeb Services Spatial Query data source.

Parameters
center:GeoPoint — The latlon value of the requested center point
 
spatialQueryOptions:SpatialQueryOptions — The object containing all of the search options
 
responder:IResponder — The user defined IResponder object to be called upon SOAP response

See also

Examples
Basic_SpatialQuery_without_map
<?xml version="1.0" encoding="utf-8"?>
<mx:Application
    xmlns:mx="http://www.adobe.com/2006/mxml"
    xmlns:awx="http://www.arcwebservices.com/2007/awx"
    pageTitle="Basic SpatialQuery - findFeaturesByPoint()"
    implements="mx.rpc.IResponder"
    creationComplete="onComplete()"
    >
    <mx:Script>
        <![CDATA[
            import com.esri.aws.awx.geom.GeoPoint;
            import com.esri.aws.osgi.framework.ServiceTracker;
            import com.esri.aws.osgi.framework.IServiceReference;
            import com.esri.aws.services.ISpatialQuery;
            import com.esri.aws.services.ResultSet;
            import com.esri.aws.services.ResultSetRange;
            import com.esri.aws.services.SearchOptions;
            import com.esri.aws.services.SpatialQueryOptions;

            import flash.utils.getQualifiedClassName;
            import mx.collections.ArrayCollection;
            import mx.controls.Alert;
            import mx.rpc.IResponder;
            
            private var spatialTracker:ServiceTracker;
            
            private function onComplete():void
            {
                spatialTracker = new ServiceTracker(Framework.getInstance().systemContext, getQualifiedClassName(ISpatialQuery));
                spatialTracker.open();
            }

            private function doQuery():void
            {
                var spatialService:ISpatialQuery = spatialTracker.getService() as ISpatialQuery;
                
                if (spatialService)
                {
                    //build some simple options to return the closest state/province polygon
                    var sqOptions:SpatialQueryOptions = new SpatialQueryOptions();
                    sqOptions.dataSource = "ArcWeb:ESRI.AdminAreas.World";
                    sqOptions.returnDistance = true;
                    var s2:SearchOptions = new SearchOptions;
                    var s3:ResultSetRange = new ResultSetRange;
                    sqOptions.searchOptions = s2;
                    s2.resultSetRange = s3;
                    s3.count = 1;
                    spatialService.findFeaturesByPoint(new GeoPoint(-117, 33), sqOptions, this);
                }
            }
            
            public function result(data:Object):void
            {
                try {
                    var rs:ResultSet = ResultSet(data);
                    for(var j:int = 0; j < rs.rows.length; j++)
                    {
                        for(var k:int = 0; k < rs.fields.length; k++) {
                            log.htmlText += "<b>" + rs.fields[k].name + ":</b> " + rs.rows[j].fieldValues[k] + ".<br>";
                        }
                    }
                }
                catch(error:Error)
                {
                    Alert.show(error.message);
                }
            }
            
            public function fault(info:Object):void
            {
                Alert.show(info.toString());
            }
        ]]>
    </mx:Script>

    <awx:Framework id="m_framework" apiKey="[MY-API-KEY]">
        <awx:SpatialQueryActivator/>
    </awx:Framework>

    <mx:Button label="Run a SpatialQuery" click="doQuery()"/>
    <mx:Panel title="SpatialQuery Results">
        <mx:TextArea id="log" minHeight="200" minWidth="300"/>
    </mx:Panel>
</mx:Application>