Packagecom.esri.ags.tasks
Classpublic class Locator
InheritanceLocator Inheritance BaseTask Inheritance flash.events.EventDispatcher

Represents a geocode service resource exposed by the ArcGIS Server REST API (available in ArcGIS Server 9.3 and above). It is used to generate candidates for an address. It also used to find an address for a given location.

Set the url to the ArcGIS Server REST resource that represents a Locator service, e.g. http://tasks.arcgisonline.com/ArcGIS/rest/services/Locators/TA_Address_NA/GeocodeServer. For more information on constructing a URL, see Using the ArcGIS Services Directory.

See also

com.esri.ags.events.LocatorEvent
Live Sample - using addressToLocations() with a Locator.
Live Sample - using arealengthsComplete and simplifyComplete with a GeometryService.
Geocode Service (REST documentation)


Public Properties
 PropertyDefined by
  addressToLocationsLastResult : Array
The last result of the addressToLocations function execution.
Locator
 Inheritedconcurrency : String = "multiple"
Value that indicates how to handle multiple calls to the same task.
BaseTask
 InheriteddisableClientCaching : Boolean
If true, adds a timestamp parameter ("_ts") to the REST request to prevent the request from being loaded from the browser's cache.
BaseTask
  locationToAddressLastResult : AddressCandidate
The result from the most recent locationToAddress call.
Locator
 InheritedproxyURL : String
The URL to proxy the request through.
BaseTask
 InheritedrequestTimeout : Number = -1
The request timeout in seconds.
BaseTask
 InheritedshowBusyCursor : Boolean = false
If true, a busy cursor is displayed while a service is executing.
BaseTask
 Inheritedtoken : String
Token for accessing a secure task.
BaseTask
 Inheritedurl : String
URL of the task.
BaseTask
Public Methods
 MethodDefined by
  
Locator(url:String = null)
Creates a new Locator object.
Locator
  
addressToLocations(address:Object, outFields:Array = null, responder:IResponder = null):AsyncToken
Sends a request to the ArcGIS REST geocode resource to find candidates for a single address specified in the address argument.
Locator
  
locationToAddress(location:MapPoint, distance:Number = 0, responder:IResponder = null):AsyncToken
Locates an address based on a given point.
Locator
Events
 EventSummaryDefined by
   Dispatched when an addressToLocations operation successfully completes.Locator
   Dispatched when a Locator request fails.Locator
   Dispatched when a locationToAddress operation successfully completes.Locator
Property detail
addressToLocationsLastResultproperty
public var addressToLocationsLastResult:Array

The last result of the addressToLocations function execution.

This property can be used as the source for data binding.

See also

locationToAddressLastResultproperty 
public var locationToAddressLastResult:AddressCandidate

The result from the most recent locationToAddress call.

This property can be used as the source for data binding.

Constructor detail
Locator()constructor
public function Locator(url:String = null)

Creates a new Locator object.

Parameters
url:String (default = null) — [optional] URL to the ArcGIS Server REST resource that represents a map layer.
Method detail
addressToLocations()method
public function addressToLocations(address:Object, outFields:Array = null, responder:IResponder = null):AsyncToken

Sends a request to the ArcGIS REST geocode resource to find candidates for a single address specified in the address argument. On completion, the addressToLocationsComplete event is fired and the optional callback responder is invoked.

Parameters
address:Object — The address object.
 
outFields:Array (default = null) — The array of fields to include in the returned result set. If you specify the shape field in the list of return fields, it is ignored. For non-intersection addresses you can specify the candidate fields as defined in the geocode service. For intersection addresses you can specify the intersection candidate fields.
 
responder:IResponder (default = null) — The responder to call on result or fault.
locateTask.addressToLocations(myAddress, myOutFields, new AsyncResponder(onResult, onFault));

Returns
AsyncToken
locationToAddress()method 
public function locationToAddress(location:MapPoint, distance:Number = 0, responder:IResponder = null):AsyncToken

Locates an address based on a given point.

Parameters
location:MapPoint — The point at which to search for the closest address. The location should be in the same spatial reference as that of the geocode service.
 
distance:Number (default = 0) — The distance in meters from the given location within which a matching address should be searched. If this parameter is not provided or an invalid value is provided. Default is 0 meters.
 
responder:IResponder (default = null) — The responder to call on result or fault.
locateTask.locationToAddress(myMapPoint, 100);

Returns
AsyncToken
Event detail
addressToLocationsCompleteevent 
Event object type: com.esri.ags.events.LocatorEvent
LocatorEvent.type property = com.esri.ags.events.LocatorEvent.ADDRESS_TO_LOCATIONS_COMPLETE

Dispatched when an addressToLocations operation successfully completes.

Defines the value of the type property of an addressToLocationsComplete event object.

faultevent  
Event object type: mx.rpc.events.FaultEvent

Dispatched when a Locator request fails. Applies to both methods.

locationToAddressCompleteevent  
Event object type: com.esri.ags.events.LocatorEvent
LocatorEvent.type property = com.esri.ags.events.LocatorEvent.LOCATION_TO_ADDRESS_COMPLETE

Dispatched when a locationToAddress operation successfully completes.

Defines the value of the type property of a locationToAddressComplete event object.