MapTrip SDK Android Manual 9.8.8
Geocoder Class Reference

The geocoder finds geographic coordinates from data like streets, cities, postal codes and more or the other way around. It can deal with incomplete or wrong information (typos in names or double meanings) and generates a list of possible results.
Attention: Some of the functions return may return invalid waypoints, if an error occurred. This may happen, if the map data provider delivered inconsistent data. The handle of the object will then be negative and represents the error code of this operation. You can check this by the function isValid() of the returned object. More...

Static Public Member Functions

static void addTaskListener (TaskListener listener)
 
static Task< Iterable< Waypoint > > getNearestAddressByCount (final Position pos, final int count)
 
static Task< Iterable< Waypoint > > getNearestAddressByRadius (final Position pos, final int radius)
 
static String getNextPossibleChars ()
 
static Task< Iterable< Waypoint > > listAddress (final Waypoint wpt)
 
static Task< Iterable< Waypoint > > listAddressExpression (final String expression, final String country)
 
static Iterable< WaypointlistAvailableCountries ()
 
static Task< Iterable< Waypoint > > listCities (final String city, final String country)
 
static Task< Iterable< Waypoint > > listCitiesOrPostCodes (final String cityOrPostcode, final String country)
 
static Task< Iterable< Waypoint > > listCrossRoads (final int index, final String crossroad)
 
static Task< Iterable< Waypoint > > listHouseNumbers (final int index, final String housenumber)
 
static Task< Iterable< Waypoint > > listPostCodes (final String postCode, final String country)
 
static Task< Iterable< Waypoint > > listStreets (final int index, final String street)
 
static void removeAllTaskListeners ()
 
static void removeTaskListener (TaskListener listener)
 

Detailed Description

Use the geocoder list... function for a hierarchical geocoding process. A hierarchical geocoding process starts with a call of Geocoder.listCities() or Geocoder.listPostCodes().

E.g. call Geocoder.listCities() with city = "Bo" to ask for a list of all cities beginning with "Bo" or Geocoder.listPostCodes() with postCode = "53" to ask for a list of all post code areas beginning with "53".
But if there are to many possible hits, the result list will be limited. In that case you have to use a more detailed search string (e.g. "Bonn").

If you like to list all streets beginning with "Riem" within one of the cities/post code areas you have previously searched with invoking Geocoder.listCitiesOrPostCodes(), call Geocoder.listStreets() with street = "Riem" and the the index of the corresponding city/post code area.

After that you can list all house numbers within one street with Geocoder.listHouseNumbers() or list all cross roads with Geocoder.listCrossRoads().

The list... functions return an iterator of waypoints. These contain no valid geocoordinates. To get valid coordinates you have to call one of the geocode... functions. This iterator is only valid until another call of one of the list... functions.

Use the reverse geocoder functions Geocoder.getNearestAddressByRadius() and Geocoder.getNearestAddressByCount() to retrieve the nearest addresses around a given position.

Member Function Documentation

◆ addTaskListener()

static void addTaskListener ( TaskListener  listener)
static

◆ getNearestAddressByCount()

static Task< Iterable< Waypoint > > getNearestAddressByCount ( final Position  pos,
final int  count 
)
static

Starts a reverse geocoding search of the nearest addresses (linear distance) around a given position. The search radius is limited to 5km.

Parameters
count- max number of addresses that will be returned.
pos- position to start search
Returns
Task object. The result of the task Task.getResult() is an iterator of waypoints on the nearest addresses ordered by distance.

◆ getNearestAddressByRadius()

static Task< Iterable< Waypoint > > getNearestAddressByRadius ( final Position  pos,
final int  radius 
)
static

Starts a reverse geocoding search of the nearest addresses around a given position. The maximal amount of results is limited to 100.

Parameters
radius- for the search around to given point (in meter).
pos- position to start search
Returns
Task object. The result of the task Task.getResult() is an iterator of waypoints on the nearest addresses ordered by distance.

◆ getNextPossibleChars()

static String getNextPossibleChars ( )
static

Attention
onboard only

Precondition
Requires: previous call to Geocoder.listCities() or Geocoder.listPostCodes() or Geocoder.listStreets() or Geocoder.listHouseNumbers() or Geocoder.listCrossRoads().

After a call of Geocoder.listCities() with parameter x as the search string for the city, this function returns a list of all characters with the following condition: If the character is appended to x a call of Geocoder.listCities() returns a non empty list.

◆ listAddress()

static Task< Iterable< Waypoint > > listAddress ( final Waypoint  wpt)
static

Non hierarchical geocoding of a given address. This is an asynchronous operation returning a Task. To receive the progress and finished events register the callback TaskListener.taskProgress() or TaskListener.taskFinished()

Parameters
wpt- A waypoint containing address information.
Returns
Task object. The result of the task Task.getResult() is an iterator of waypoints that match the address information, ordered by matching probability.

◆ listAddressExpression()

static Task< Iterable< Waypoint > > listAddressExpression ( final String  expression,
final String  country 
)
static

Attention
offboard only

Non hierarchical geocoding of a single line address. This is an asynchronous operation returning a Task. To receive the progress and finished events register the callback TaskListener.taskProgress() or TaskListener.taskFinished()

Parameters
expression- Expression in free format that the geocoder will translate into an address.
country- country code of the country in which the listed cities are located (from Geocoder.listAvailableCountries()).
Returns
Task object. The result of the task Task.getResult() is an iterator of waypoints that match the address information, ordered by matching probability.

◆ listAvailableCountries()

static Iterable< Waypoint > listAvailableCountries ( )
static

Attention
onboard only

Lists all countries that are available based on the given map data.

Returns
iterator of Waypoints containing country information (No valid geocoordinates). Elements are ordered by country code.

◆ listCities()

static Task< Iterable< Waypoint > > listCities ( final String  city,
final String  country 
)
static

Attention
onboard only

Lists all cities in the "country" whose name begin with the string "city" as well as all districts beginning the passed string

Parameters
city- Name with which all cities in the returned iterator begin with.
country- Country code of the country in which the listed cities are located (from Geocoder.listAvailableCountries()).
Returns
iterator of Waypoints containing city information (No coordinates). Elements are ordered by best match.

◆ listCitiesOrPostCodes()

static Task< Iterable< Waypoint > > listCitiesOrPostCodes ( final String  cityOrPostcode,
final String  country 
)
static

Attention
onboard only

Lists all cities in the "country" whose name begin with the string "cityOrPostcode" as well as all districts beginning the passed string as well as all post codes beginning the passed string The maximal amount of results is limited to 100.

Parameters
cityOrPostcode- Name with which all cities or post codes in the returned iterator begin with.
country- Country code of the country in which the listed cities are located (from Geocoder.listAvailableCountries()).
Returns
iterator of Waypoints containing city information (No coordinates). Elements are ordered by best match.

◆ listCrossRoads()

static Task< Iterable< Waypoint > > listCrossRoads ( final int  index,
final String  crossroad 
)
static

Attention
onboard only

Precondition
Requires: previous call to Geocoder.listStreets().

Lists all crossroads in a given street that begins with "crossroad".

Parameters
index- index of the element in the waypoint iterator generated from Geocoder.listStreets().
crossroad- name with which all crossroads in the returned iterator begin with.
Returns
iterator of Waypoints containing city, street and crossroad information (No valid geocoordinates). Elements are ordered by cross roads.

◆ listHouseNumbers()

static Task< Iterable< Waypoint > > listHouseNumbers ( final int  index,
final String  housenumber 
)
static

Attention
onboard only

Precondition
Requires: previous call to Geocoder.listStreets()

Lists all houseNumbers in a given street that begins with "housenumber".

Parameters
index- index of the element in the waypoint iterator generated from Geocoder.listStreets().
housenumber- housenumber to search for.
Returns
iterator of waypoints containing city, street and housenumber information (No valid geocoordinates). Elements are ordered by house number.

◆ listPostCodes()

static Task< Iterable< Waypoint > > listPostCodes ( final String  postCode,
final String  country 
)
static

Attention
onboard only

Lists all post codes in the "country" whose code begins with the string "postCode".

Parameters
postCode- postcode with which all postCodes in the returned iterator begin with.
country- country code of the country in which the listed cities are located (from Geocoder.listAvailableCountries()).
Returns
iterator of Waypoints containing city information (No valid geocoordinates). Elements are ordered by post code.

◆ listStreets()

static Task< Iterable< Waypoint > > listStreets ( final int  index,
final String  street 
)
static

Attention
onboard only

Precondition
Requires: previous call to Geocoder.listCities() or Geocoder.listPostCodes().

Lists all Streets in a given city whose name begins with "street".

Parameters
index- index of the element in the waypoint iterator generated from Geocoder.listCities() or Geocoder.listPostCodes().
street- name with which all streets in the returned iterator begin with.
Returns
iterator of waypoints containing city and street information (No valid geocoordinates). Elements are ordered by street.

◆ removeAllTaskListeners()

static void removeAllTaskListeners ( )
static

◆ removeTaskListener()

static void removeTaskListener ( TaskListener  listener)
static

The documentation for this class was generated from the following file: