HERE iOS SDK Developer's Guide

Coverage Search

Urban Mobility Coverage Search provides detailed information about the regions and cities with public transit data that are supported by HERE SDK. For example, you can get a list of cities that have transit data coverage by using a query request with a search area. You can create this type of request by using the createCityCoverageRequest method in NMAUrbanMobilityRequestManager to generate a city coverage request object.

// request manager singleton
NMAUrbanMobilityRequestManager *requestManager =
  [NMAUrbanMobilityRequestManager sharedRequestManager];

// Chicago, Millenium Park
NMAGeoCoordinates *location =
  [NMAGeoCoordinates geoCoordinatesWithLatitude:41.882736 longitude:-87.622004];

// Search completion block
void (^completeSearch) (NMAUrbanMobilityCityCoverageResult *, NSError *) =
  ^(NMAUrbanMobilityCityCoverageResult *coverageResult, NSError *error) {
  if (error) {
    // Handle error
    switch (error.code) {
      case NMAUrbanMobilityErrorNotFound:
        // No stations were found
        break;
      default:
        // Handle other errors
        break;
    }
  } else {
    NSArray *cities = coverageResult.nearbyCities;
    for (NMAUrbanMobilityCity *city in cities) {
      // Handle city
    }
  }
};

NMAUrbanMobilityCityCoverageRequest *request =
  [requestManager createCityCoverageRequest];

// you can set additional request parameters here
request.location = location;
request.radius = 4000;
request.updateType = NMACoverageUpdateType.NMACoverageUpdateTypeUpdated;

// Search was triggered successfully
BOOL success;

// Start asynchronous stations search
success = [request startWithCompletionBlock:completeSearch];

Another supported type of coverage search uses a query string to look for cities with names that begin with this substring. You can create this type of request by using the createCitySearchRequestWithCity: method in NMAUrbanMobilityRequestManager.

// request manager singleton
NMAUrbanMobilityRequestManager *requestManager =
  [NMAUrbanMobilityRequestManager sharedRequestManager];

// Search completion block
void (^completeSearch) (NMAUrbanMobilityCitySearchResult *, NSError *) =
  ^(NMAUrbanMobilityCitySearchResult *searchResult, NSError *error) {
  if (error) {
    // Handle error
    switch (error.code) {
      case NMAUrbanMobilityErrorNotFound:
        // No stations were found
        break;
      default:
        // Handle other errors
        break;
    }
  } else {
    NSArray *cities = searchResult.cities;
    for (NMAUrbanMobilityCity *city in cities) {
      // Handle city
      NSString *cityname = city.name;
      float coverageQuality = city.quality;
    }
  }
};

NSString *searchText = @"Rome";

NMAUrbanMobilityCityCoverageRequest *request =
  [requestManager createCitySearchRequestWithCity:searchText];

// Search was triggered successfully
BOOL success;

// Start asynchronous stations search
success = [request startWithCompletionBlock:completeSearch];

You can also use NMAUrbanMobilityNearbyCoverageRequest to search for coverage information around a given location. This type of search returns information of the city that contains this location. If there is no transit stop within 2 kilometers of the location, the request returns the first five nearest transit stops outside of the 2 kilometers area. This type of search result is also known as an "Explored Coverage". The following code demonstrates how to retrieve both nearby and explored coverage results.

NMAGeoCoordinates *location =
  [NMAGeoCoordinates geoCoordinatesWithLatitude:52.521918 longitude:13.413215];

// request manager singleton
NMAUrbanMobilityRequestManager *requestManager =
  [NMAUrbanMobilityRequestManager sharedRequestManager];

// Search completion block
void (^completeSearch) (NMAUrbanMobilityNearbyCoverageResult *, NSError *) =
  ^(NMAUrbanMobilityNearbyCoverageResult *coverageResult, NSError *error) {
  if (error) {
    // Handle error
    switch (error.code) {
      case NMAUrbanMobilityErrorNotFound:
        // No stations were found
        break;
      default:
        // Handle other errors
        break;
    }
  } else {
    NSInteger *radius = coverageResult.radius;
    NMAUrbanMobilityCity *city = coverageResult.city;
    NMAUrbanMobilityExploredCoverage *exploredCoverage = coverageResult.exploredCoverage;
    if (!exploredCoverage) {
      // exploredCoverage.stations
    }
  }
};

NMAUrbanMobilityNearbyCoverageRequest *request =
  [requestManager createNearbyCoverageRequestForLocation:location];

// Variable for whether search was triggered successfully
BOOL success;

// Start asynchronous stations search
success = [request startWithCompletionBlock:completeSearch];

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.