public class

LocatorSuggestionParameters

extends Object
java.lang.Object
   ↳ com.esri.core.tasks.geocode.LocatorSuggestionParameters

Class Overview

Class representing parameters for a geocoding suggestion operation. Geocoding suggestions provide character-by-character auto-completion for facilitating interactive search experiences.

The only parameter required for suggestions is textual input, but an optional location and distance can be specified to return relevant results based on a radial search area. When a location is set on the parameters with setLocation(Point, SpatialReference), candidates within the default radial search distance (2000m) have a higher likelihood of being returned as results. The radial distance can be adjusted using the setDistance(double) method, though a location must be set for it to have any effect.

Summary

Public Constructors
LocatorSuggestionParameters(String text)
Constructs a new suggestion parameters with the specified text.
Public Methods
String getCategory()
Gets the category used to filter suggest results.
String getCountryCode()
Gets the country code used to limit the returned suggestions.
double getDistance()
Returns the distance used for location based suggestions.
Point getLocation()
Gets the location used for location aware suggestions.
int getMaxSuggestions()
Gets the maximum number of suggestions to be returned by a suggest operation.
Envelope getSearchExtent()
Gets the bounding envelope used to limit the suggest search area.
String getText()
Gets the search text.
void setCategory(String category)
Sets a place or address type which can be used to filter suggest results.
void setCountryCode(String countryCode)
Sets a country code used to limit the returned suggestions to values in a particular country.
void setDistance(double distance)
Sets the radial distance to be used in conjunction with the location specified in setLocation(Point, SpatialReference).
void setLocation(Point location, SpatialReference spatialReference)
Sets the location to be used for proximity based suggestion.
void setMaxSuggestions(int maxSuggestions)
Sets the maximum number of suggestions to be returned by a suggest operation, up to the maximum number allowed by the service.
void setSearchExtent(Envelope searchExtent, SpatialReference spatialReference)
Sets an envelope that limits the search area for suggestions to a specific region.
void setText(String text)
Sets the search text.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public LocatorSuggestionParameters (String text)

Constructs a new suggestion parameters with the specified text. Example suggestion texts:

  • Addresses : 380 New York St.
  • POIs : Starbucks
  • Categories : Coffee Shops

Parameters
text String: The text to be used for suggestions.

Public Methods

public String getCategory ()

Gets the category used to filter suggest results. See setCategory(String) for more information.

Returns
String the category used to filter suggest results

public String getCountryCode ()

Gets the country code used to limit the returned suggestions. See setCountryCode(String) for more information.

Returns
String the country code used to limit the returned suggestions

public double getDistance ()

Returns the distance used for location based suggestions.

Returns
double the radial search distance in meters.

public Point getLocation ()

Gets the location used for location aware suggestions.

Returns
Point the location used as the center point for suggestion.

public int getMaxSuggestions ()

Gets the maximum number of suggestions to be returned by a suggest operation. See setMaxSuggestions(int) for more information.

Returns
int the maximum number of suggestions to be returned

public Envelope getSearchExtent ()

Gets the bounding envelope used to limit the suggest search area. See setSearchExtent(Envelope, SpatialReference) for more information.

Returns
Envelope the bounding envelope

public String getText ()

Gets the search text.

Returns
String the text used for suggestions.

public void setCategory (String category)

Sets a place or address type which can be used to filter suggest results. The parameter supports input of single category values or multiple comma-separated values.

Parameters
category String: the category used to filter suggest reults

public void setCountryCode (String countryCode)

Sets a country code used to limit the returned suggestions to values in a particular country. Supported values include the ISO 3166-1 2-digit country code or the ISO 3166-1 3-digit country code. An example two letter country code could be UK, and a three letter country code could be USA.

Parameters
countryCode String: the country code with which to limit the returned suggestions

public void setDistance (double distance)

Sets the radial distance to be used in conjunction with the location specified in setLocation(Point, SpatialReference). Suggestion candidates within the radial distance are more likely to be returned as results. If a radial distance is specified without a location, it will be ignored. By default, this value is 2000 meters.

Parameters
distance double: The radial distance in meters.

public void setLocation (Point location, SpatialReference spatialReference)

Sets the location to be used for proximity based suggestion. When a location is specified, results within the radial distance of the location will have their scores boosted (more likely to be returned). By default, if no distance is specified, the search distance is 2000 meters. See setDistance(double) for specifying the radial distance.

Parameters
location Point: The location used as a center point for suggestions.
spatialReference SpatialReference: The spatial reference of location (can be null).

public void setMaxSuggestions (int maxSuggestions)

Sets the maximum number of suggestions to be returned by a suggest operation, up to the maximum number allowed by the service. Currently the World Geocoding Service allows up to 15 suggestions to be returned. If maxSuggestions is not included in the suggest request then the default value is 5.

Parameters
maxSuggestions int: the maximum number of suggestions to be returned

public void setSearchExtent (Envelope searchExtent, SpatialReference spatialReference)

Sets an envelope that limits the search area for suggestions to a specific region. This is especially useful for applications in which a user will search for places and addresses within the current map extent. You can specify the spatial reference of the searchExtent coordinates, which is necessary if the map spatial reference is different than that of the geocoding service; otherwise, the spatial reference of the coordinates is assumed to be the same as that of the geocoding service.

Parameters
searchExtent Envelope: the bounding envelope with which to restrict the search
spatialReference SpatialReference: the spatial reference of the envelope coordinates

public void setText (String text)

Sets the search text.

Parameters
text String: The text to be used for suggestions.