| Package | com.esri.aws.services |
| Class | public class SpatialQueryOptions |
| Property | Defined by | ||
|---|---|---|---|
| dataSource : String
The name of the data source to use for spatial querying.
| SpatialQueryOptions | ||
| distanceUnits : String = "miles"
The units used to measure the distance from the
input search point or geometry to individual results from the
spatial query data source.
| SpatialQueryOptions | ||
| returnDistance : Boolean = false
If true, distances are returned from the input search geometry to
the individual results from the spatial query data source.
| SpatialQueryOptions | ||
| returnGeometry : Boolean = false
If true, returns latitude and longitude values.
| SpatialQueryOptions | ||
| searchOptions : SearchOptions
The parameters for the search results.
| SpatialQueryOptions | ||
| spatialBuffer : SpatialBuffer
The buffer area in which to search for results.
| SpatialQueryOptions | ||
| dataSource | property |
public var dataSource:StringThe name of the data source to use for spatial querying. Required.
| distanceUnits | property |
public var distanceUnits:String = "miles"The units used to measure the distance from the input search point or geometry to individual results from the spatial query data source. Valid values are "km" (kilometers) or "miles".
The default value is "miles".
| returnDistance | property |
public var returnDistance:Boolean = falseIf true, distances are returned from the input search geometry to the individual results from the spatial query data source.
The default value is false..
| returnGeometry | property |
public var returnGeometry:Boolean = falseIf true, returns latitude and longitude values. Default value is false. Only valid for feature searches on points.
| searchOptions | property |
public var searchOptions:SearchOptionsThe parameters for the search results.
| spatialBuffer | property |
public var spatialBuffer:SpatialBufferThe buffer area in which to search for results.
<?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>