HERE Android SDK Developer's Guide

Transit Station Search

Figure 1. Station Search by Coordinates

The Transit Stations Search feature allows users to discover transit stations by searching for stations around a specified location. For example, your application can look for the nearest subway station by retrieving all subway stations at the current location with the specified radius.

The following code demonstrates how to trigger a station search by location:

GeoCoordinate centerCoordinates = new GeoCoordinate(40.750488, -73.993546);  //somewhere in NY

// listener that will be notified after request is completed
RequestManager.ResponseListener<StationSearchResult> responseListener = new RequestManager.ResponseListener<StationSearchResult>() {

  @Override public void onSuccess(StationSearchResult searchResult) {
    List<Station> foundStations = searchResult.getStations();
    Collection<Transport> transports = searchResult.getTransports();
    for (Station station: foundStations) {
      String stationName = station.getAddress().getName();
      // ...
    // ...

  @Override public void onError(ErrorCode errorCode, String errorMessage) {
    // report error

// creating and executing the request
// search stations nearby
StationSearchRequest requestNearby = new RequestManager().createStationSearchRequest(
    centerCoordinates, "", responseListener)
Figure 2. Station Search by Name

You can also search for public transit stations by providing its name. For example, a user searching for "Penn" retrieves all stations that match that name. This search is location-aware, so results are sorted by proximity to the current location.

The following code demonstrates how to perform a station search and filter by the specified name:

// search stations nearby with given name filter, returning transports information
StationSearchRequest requestName = new RequestManager().createStationSearchRequest(
    centerCoordinates, "Penn", responseListener)

You can also retrieve a station directly by specifying the station IDs while creating the StationSearchRequest, as demonstrated in the following:

Set<String> ids = new HashSet<String>();

// search stations by given IDs
StationSearchRequest requestIds = new RequestManager().createStationSearchRequest(
    ids, responseListener);