HERE Android SDK Developer's Guide

GeocodeRequest2

The class GeocodeRequest2 is a member of com.here.android.mpa.search .

Class Summary

public class GeocodeRequest2

extends com.here.android.mpa.search.Request, java.lang.Object

The GeocodeRequest2 represents an extended Request used to retrieve GeocodeResult data by way of Geocoder search services.

[For complete information, see the section Class Details]

Constructor Summary

Table 1. Constructors in GeocodeRequest2
Constructors

GeocodeRequest2 (String query)

Creates a geocoder request that resolves a free text query into a GeocodeResult.

Method Summary

Table 2. Methods in GeocodeRequest2
Methods

public ErrorCode execute (ResultListener<GeocodeResult> listener)

Executes an asynchronous request.

public int getCollectionSize ()

Gets the current collection size being used for request responses.

public GeocodeRequest2 setCollectionSize (int value)

Sets a collection size to be used for request responses.

public GeocodeRequest2 setMapViewport (GeoBoundingBox mapViewport)

The map viewport is a bounding box of the map area currently visible to the user.

public GeocodeRequest2 setSearchArea (GeoCoordinate center, int radius)

Sets the suggested search area using a center location and radius.

public GeocodeRequest2 setSearchArea (GeoBoundingBox boundingArea)

Sets the suggested search area using a GeoBoundingBox .

Class Details

The GeocodeRequest2 represents an extended Request used to retrieve GeocodeResult data by way of Geocoder search services.

Note: the response to a GeocodeRequest2 is a list of GeocodeResult objects.

Constructor Details

GeocodeRequest2 (String query)

Creates a geocoder request that resolves a free text query into a GeocodeResult.

Please note that if this free text query contains search area information, such as a state, then the search area set through setSearchArea(GeoBoundingBox) or setSearchArea(GeoCoordinate, int) is ignored. For example, a search for "Main St, Ohio" with a search area of New York City will return results outside of New York City. However, a search for "Park Ave" with New York City as the search area will return results in that area.

Parameters:

  • query

    Query text specifying the address to locate.

Throws:

  • IllegalArgumentException

    Upon a failure to handle a passed argument.

Method Details

public ErrorCode execute (ResultListener<GeocodeResult> listener)

Executes an asynchronous request.

Parameters:

  • listener

    A ResultListener passed along with the request to monitor progress.

Returns:

The ErrorCode representing an appropriate result.

public int getCollectionSize ()

Gets the current collection size being used for request responses.

Returns:

The current response collection size.

public GeocodeRequest2 setCollectionSize (int value)

Sets a collection size to be used for request responses. The maximum number of result items in each collection will be limited to this value. The valid value range is [1..100]. The default collection size is 20.

Parameters:

  • value

    Desired response collection size per request.

Returns:

This Request object.

Throws:

  • IllegalArgumentException

    if size is out of range.

public GeocodeRequest2 setMapViewport (GeoBoundingBox mapViewport)

The map viewport is a bounding box of the map area currently visible to the user. The viewport can act as an implicit location context in the absence of an explicit location context. To ensure you get the best results possible, you should always set a viewport if there is a map visible to the user.

Please note that the Map Viewport is only used for online geocode requests.

Parameters:

  • mapViewport

    The bounding box of the map area currently visible.

public GeocodeRequest2 setSearchArea (GeoCoordinate center, int radius)

Sets the suggested search area using a center location and radius.

Please note that the Search Area is only used for online geocode requests.

Parameters:

  • center

    The GeoCoordinate representing the search area center location.

  • radius

    The search area circle radius in meters (greater-equal than 0).

Returns:

The GeocodeRequest2.

public GeocodeRequest2 setSearchArea (GeoBoundingBox boundingArea)

Sets the suggested search area using a GeoBoundingBox .

Please note that the Search Area is only used for online geocode requests.

Parameters:

  • boundingArea

    The GeoBoundingBox representing the search area.

Returns:

The GeocodeRequest2.