public class

Locator

extends Object
java.lang.Object
   ↳ com.esri.core.tasks.ags.geocode.Locator

Class Overview

This class allows you to geocode and reverse-geocode addresses using a geocode service of ArcGIS Server.

Geocoding involves finding matching locations for a given address.

Reverse-geocoding involves finding corresponding addresses for a given location.

Summary

Public Constructors
Locator()
Constructs a default locator object.
Locator(String url)
Constructor accepting the URL of a Geocode service.
Locator(String url, UserCredentials credentials)
Constructor accepting the URL of a Geocode service.
Public Methods
List<LocatorGeocodeResult> find(LocatorFindParameters findParams)
Executes a finding operation to find location candidates for a given address, POI, or a String
Note: currently the method is only applied to the world geocoding service hosted on the ArcGIS online.
List<LocatorGeocodeResult> geocode(Map<StringString> addressFields, List<String> outFields, SpatialReference outSR)
Executes a geocoding operation to find location candidates for a given address.
List<LocatorGeocodeResult> geocode(Map<StringString> addressFields, List<String> outFields)
Executes a geocoding operation to find location candidates for a given address.
LocatorServiceInfo getInfo()
Returns the information of the Geocode service this instance is querying from such as address fields, candidate fields, service properties...
String getUrl()
Returns the URL of the Geocode service used by this instance of the Locator.
LocatorReverseGeocodeResult reverseGeocode(Point point, double distance)
Executes a reverse-geocoding operation to find address candidates for a given location.
LocatorReverseGeocodeResult reverseGeocode(Point point, double distance, SpatialReference inSR, SpatialReference outSR)

Executes a reverse-geocoding operation to find address candidates for a given location.

[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public Locator ()

Constructs a default locator object.
The default locator uses the ESRI ArcGIS online worldwide geocoding service.
The endpoint of the service is "http://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer".

public Locator (String url)

Constructor accepting the URL of a Geocode service.

Parameters
url URL to the REST endpoint of a Geocode service

public Locator (String url, UserCredentials credentials)

Constructor accepting the URL of a Geocode service.

Parameters
url URL to the REST endpoint of a Geocode service
credentials the credentials used for accessing a secure Geocode service

Public Methods

public List<LocatorGeocodeResult> find (LocatorFindParameters findParams)

Executes a finding operation to find location candidates for a given address, POI, or a String
Note: currently the method is only applied to the world geocoding service hosted on the ArcGIS online. You may obtain an exception for other geocoding service which is not supported for the operation.

The Find operation of a geocoding service is used for single field geocoding, and supports finding the following types of locations:

  • Street addresses: 380 New York St, Redlands, CA 92373
  • Administrative place names, such as city/county/state/province/country names: Seattle, Washington
  • Postal codes: 92591 USA
  • Points of interest (POI) and businesses:
  • Disneyland
    banks in Paris
The output fields can be specified, passing null will return all the output fields defined for the service.
The location candidates will be returned in the spatial reference passed in the parameters, passing -1 will return the locations in the default spatial reference defined for the service.

Parameters
findParams A
Returns
Throws
Exception the exception

public List<LocatorGeocodeResult> geocode (Map<StringString> addressFields, List<String> outFields, SpatialReference outSR)

Executes a geocoding operation to find location candidates for a given address.
The output fields can be specified, passing null will return all the output fields defined for the service.
The location candidates will be returned in the spatial reference passed in the parameters, passing -1 will return the locations in the default spatial reference defined for the service.

Parameters
addressFields a Map containing the address fields and their corresponding values
outFields a List of output fields to be returned for each address candidate
outSR a spatial reference the location candidates will be projected to.
Returns
Throws
Exception the exception

public List<LocatorGeocodeResult> geocode (Map<StringString> addressFields, List<String> outFields)

Executes a geocoding operation to find location candidates for a given address.
The output fields can be specified, passing null will return all the output fields defined for the service.

Parameters
addressFields a Map containing the address fields and their corresponding values
outFields a List of output fields to be returned for each address candidate
Returns
Throws
Exception the exception

public LocatorServiceInfo getInfo ()

Returns the information of the Geocode service this instance is querying from such as address fields, candidate fields, service properties...

Returns
Throws
Exception the exception

public String getUrl ()

Returns the URL of the Geocode service used by this instance of the Locator.

Returns
  • the URL of the Geocode service used by this instance of the Locator

public LocatorReverseGeocodeResult reverseGeocode (Point point, double distance)

Executes a reverse-geocoding operation to find address candidates for a given location.
A distance in meters from the given location within which a matching address should be searched must be provided, 0 if non is desired.

Parameters
point the location to search for address candidates.
distance the distance in meters from the given location within which a matching address should be searched.
Throws
Exception the exception

public LocatorReverseGeocodeResult reverseGeocode (Point point, double distance, SpatialReference inSR, SpatialReference outSR)

Executes a reverse-geocoding operation to find address candidates for a given location.
A distance in meters from the given location within which a matching address should be searched must be provided, 0 if non is desired.
The input spatial reference can be specified if the location coordinates are in a different spatial reference than the one expected by the service.
An Output spatial reference can be specified if the coordinates for the address candidates are wanted in a different spatial reference than the one defined in the service.

Parameters
point the location to search for address candidates.
distance the distance in meters from the given location within which a matching address should be searched.
inSR the input spatial reference for the location.
outSR the output spatial reference for the location of the address candidates
Throws
Exception the exception