com.esri.core.tasks.ags.geocode
Class Locator

java.lang.Object
  extended by com.esri.core.tasks.ags.geocode.Locator

public class Locator
extends Object

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.


Constructor Summary
Locator(String url)
          Constructor accepting the URL of a Geocode service
Locator(String url, UserCredentials credentials)
          Constructor accepting the URL of a Geocode service
 
Method Summary
 List<LocatorGeocodeResult> geocode(Map<String,String> 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.
 List<LocatorGeocodeResult> geocode(Map<String,String> 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.
 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.
A distance in meters from the given location within which a matching address should be searched must be provided, 0 if non is desired.
 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.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Locator

public Locator(String url)
Constructor accepting the URL of a Geocode service

Parameters:
url - URL to the REST endpoint of a Geocode service

Locator

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
Method Detail

getUrl

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

getInfo

public LocatorServiceInfo getInfo()
                           throws Exception
Returns the information of the Geocode service this instance is querying from such as address fields, candidate fields, service properties...

Returns:
a LocatorServiceInfo containing the service information
Throws:
Exception

geocode

public List<LocatorGeocodeResult> geocode(Map<String,String> addressFields,
                                          List<String> outFields)
                                   throws Exception
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 containg the address fields and their corresponding values
outFields - a List of output fields to be returned for each address candidate
Returns:
a List of LocatorGeocodeResults.
Throws:
Exception

geocode

public List<LocatorGeocodeResult> geocode(Map<String,String> addressFields,
                                          List<String> outFields,
                                          SpatialReference outSR)
                                   throws Exception
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 containg 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:
a List of LocatorGeocodeResults.
Throws:
Exception

reverseGeocode

public LocatorReverseGeocodeResult reverseGeocode(Point point,
                                                  double distance)
                                           throws Exception
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.
Returns:
a LocatorReverseGeocodeResult
Throws:
Exception

reverseGeocode

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

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
Returns:
a LocatorReverseGeocodeResult
Throws:
Exception


Copyright © 2012. All Rights Reserved.