Skip To Content ArcGIS for Developers Sign In Dashboard

GeocodeParameters Class

(Esri::ArcGISRuntime::GeocodeParameters)

Parameters for geocoding using a LocatorTask. More...

Header: #include <GeocodeParameters>
Since: Esri::ArcGISRuntime 100.0

Public Functions

GeocodeParameters()
GeocodeParameters(const GeocodeParameters &other)
GeocodeParameters(GeocodeParameters &&other)
~GeocodeParameters()
QStringList categories() const
QString countryCode() const
bool isForStorage() const
int maxResults() const
double minScore() const
QString outputLanguageCode() const
SpatialReference outputSpatialReference() const
Point preferredSearchLocation() const
QStringList resultAttributeNames() const
Geometry searchArea() const
void setCategories(const QStringList &categories)
void setCountryCode(const QString &countryCode)
void setForStorage(bool forStorage)
void setMaxResults(int maxResults)
void setMinScore(double minScore)
void setOutputLanguageCode(const QString &outputLanguageCode)
void setOutputSpatialReference(const SpatialReference &outputSpatialReference)
void setPreferredSearchLocation(const Point &preferredSearchLocation)
void setResultAttributeNames(const QStringList &resultAttributeNames)
void setSearchArea(const Geometry &searchArea)
GeocodeParameters &operator=(const GeocodeParameters &other)
GeocodeParameters &operator=(GeocodeParameters &&other)

Detailed Description

Parameters for geocoding using a LocatorTask.

Use GeocodeParameters when geocoding to set the maximum results returned, limit the search extent to a given area, or to set the output language. GeocodeParameters are not required to geocode with the LocatorTask, but they give you more control over geocoding task preferences.

// create the parameters
GeocodeParameters geocodeParams;
geocodeParams.setCountryCode("Japan");
// Geocode an address in Japan - Prime Ministers Office
QString address = "東京都千代田区永田町2‐2‐2";
m_locatorTask->geocodeWithParameters(address, geocodeParams);

Member Function Documentation

GeocodeParameters::GeocodeParameters()

Default constructor.

GeocodeParameters::GeocodeParameters(const GeocodeParameters &other)

Copy constructor from other GeocodeParameters.

GeocodeParameters::GeocodeParameters(GeocodeParameters &&other)

Move constructor from other GeocodeParameters.

GeocodeParameters::~GeocodeParameters()

Destructor.

QStringList GeocodeParameters::categories() const

Returns the list of categories used for geocoding.

See also setCategories().

QString GeocodeParameters::countryCode() const

Returns the country code used for geocoding.

See also setCountryCode().

bool GeocodeParameters::isForStorage() const

Returns whether the results are for storage.

int GeocodeParameters::maxResults() const

Returns the maximum number of results that the geocoding operation should return.

See also setMaxResults().

double GeocodeParameters::minScore() const

Returns the minimum match score of a candidate in a geocoding operation.

See also setMinScore().

QString GeocodeParameters::outputLanguageCode() const

Returns the output two-character language code.

See also setOutputLanguageCode().

SpatialReference GeocodeParameters::outputSpatialReference() const

Returns the output spatial reference of the GeocodeResult.

See also setOutputSpatialReference().

Point GeocodeParameters::preferredSearchLocation() const

Returns the preferred search location of a geocoding operation.

See also setPreferredSearchLocation().

QStringList GeocodeParameters::resultAttributeNames() const

Returns the list of attribute names returned in the GeocodeResult.

See also setResultAttributeNames().

Geometry GeocodeParameters::searchArea() const

Returns the search area of a geocoding operation.

See also setSearchArea().

void GeocodeParameters::setCategories(const QStringList &categories)

Sets the list of categories used for geocoding to categories.

The category parameter limits the types of places for which the service searches, thus eliminating false positive matches and potentially speeding up the search process. You can specify categories by different levels of detail. For example, if you were searching for somewhere to eat, you could specify the category as "Korean Food" for something specific, "Food" for something more generic, or even "POI" for something very generic.

Note: Categories are currently not supported with local locators. However, a gazateer-style locator could be used instead to get a similar result.

See also categories() and Category filtering.

void GeocodeParameters::setCountryCode(const QString &countryCode)

Sets the country code used for geocoding to countryCode.

The country code applies to online locators that cover multiple countries, such as the World Geocoding Service. Providing a country code will force the locator to perform the search only within the given country. This could benefit performance when searching ambiguous addresses.

Examples of country codes include CN for China, IS for Iceland, and US for The United States.

See also countryCode() and Geocoding Country Codes.

void GeocodeParameters::setForStorage(bool forStorage)

Sets whether the results can be used for storage to forStorage.

If you plan to persist geocoding results in a database or other data store, you must set this parameter to true.

The default value is false, indicating that results of the operation will be used only temporarily, such as for for displaying the results on a map.

See also isForStorage().

void GeocodeParameters::setMaxResults(int maxResults)

Sets the maximum number of results that the geocoding operation should return to maxResults.

See also maxResults().

void GeocodeParameters::setMinScore(double minScore)

Sets the minimum match score of a candidate in a geocoding operation to minScore.

Geocoding produces a list of items in the reference data that match the search criteria. Each item compared to the search criteria receives a match score from 0 to 100, where 100 is a perfect match. Any item with a score of at least the minimum score is regarded as a match.

A match score between 85 and 99 is often considered a good match. To find such matches, set minScore to 85. If your app wants the geocoding results to include items with lower match scores, set minScore to a lower value.

Note: minScore only applies for local locators.

See also minScore().

void GeocodeParameters::setOutputLanguageCode(const QString &outputLanguageCode)

Sets the output two-character language code to outputLanguageCode.

For example, ZH for Simplified Chinese, IS for Icelandic, and EN for English.

See also outputLanguageCode() and Geocoding Language Codes.

void GeocodeParameters::setOutputSpatialReference(const SpatialReference &outputSpatialReference)

Sets the output spatial reference of the GeocodeResult to outputSpatialReference.

See also outputSpatialReference().

void GeocodeParameters::setPreferredSearchLocation(const Point &preferredSearchLocation)

Sets the preferred search location of a geocoding operation to preferredSearchLocation.

The geocoding operation can sort result items by their proximity to a preferred search location, such as the user's current location. The priority of the items within 50,000 meters of this location are boosted relative to items that are farther away.

For example, when searching by name for a business with many locations in the area, there will be many matched items even when a search area is specified. The user would have to look through the items to find the closest store. When the preferred search location is set to the user's current location, the locator can prioritize the items based on proximity to the user.

By default, no preferred search location is set.

See also preferredSearchLocation().

void GeocodeParameters::setResultAttributeNames(const QStringList &resultAttributeNames)

Sets the list of attribute names returned in the GeocodeResult to resultAttributeNames.

Check the LocatorInfo::ResultAttributes for a list of available attributes.

See also resultAttributeNames().

void GeocodeParameters::setSearchArea(const Geometry &searchArea)

Sets the search area of a geocoding operation to searchArea.

Matches return only for items within the search area, such as the map view's currently visible geographic extent.

See also searchArea().

GeocodeParameters &GeocodeParameters::operator=(const GeocodeParameters &other)

Assignment operator from other GeocodeParameters.

GeocodeParameters &GeocodeParameters::operator=(GeocodeParameters &&other)

Move operator from other GeocodeParameters.


Feedback on this topic?