HERE Android SDK Developer's Guide

GeocodeRequest

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

Class Summary

public class GeocodeRequest

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

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

[For complete information, see the section Class Details]

Constructor Summary

Table 1. Constructors in GeocodeRequest
Constructors

GeocodeRequest (String query)

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

Method Summary

Table 2. Methods in GeocodeRequest
Methods

public ErrorCode execute (ResultListener<Location> listener)

Executes an asynchronous request.

public int getCollectionSize ()

Gets the current collection size being used for request responses.

public GeocodeRequest setCollectionSize (int value)

Sets a collection size to be used for request responses.

public GeocodeRequest setMapViewport (GeoBoundingBox mapViewport)

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

public GeocodeRequest setSearchArea (GeoCoordinate center, int radius)

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

public GeocodeRequest setSearchArea (GeoBoundingBox boundingArea)

Sets the suggested search area using a GeoBoundingBox .

Class Details

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

Note: the response to a GeocodeRequest is a list of Location objects.

Constructor Details

GeocodeRequest (String query)

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

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<Location> 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 GeocodeRequest 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%3CT%3E object

Throws:

  • IllegalArgumentException

    if size is out of range.

public GeocodeRequest 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 GeocodeRequest 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 GeocodeRequest.

public GeocodeRequest 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 GeocodeRequest.

You cannot use this account to purchase a commercial plan on Developer Portal, as it is already associated to plans with different payment methods.

To purchase a commercial plan on Developer Portal, please register for or sign in with a different HERE Account.

Something took longer than expected.

The project should be available soon under your projects page.

Sorry, our services are not available in this region.

Something seems to have gone wrong. Please try again later.

We've detected that your account is set to Australian Dollars (AUD).
Unfortunately, we do not offer checkouts in AUD anymore.
You can continue using your current plan as normal, but to subscribe to one of our new plans,
please register for a new HERE account or contact us for billing questions on selfservesupport@here.com.