How to Migrate from Google Routes to HERE Routing

By Jayson DeLancey | 18 July 2018

Try HERE Maps

Create a free API key to build location-aware apps and services.

Get Started

With echoes of "Are we there yet?" Routing Services are easy to relate to
because we use them to get driving directions from point A to point B. I'm
going to take a look at a few uses to help navigate your application from Google Routes to HERE Routing.

REST Request

Let's say we're starting at 187 W 9th St. Boston, MA and heading to Gillette Stadium and need to get a simple route by making a REST service call. You can start by switching the GET request to the following endpoint:

The HERE services are typically version controlled so that you can decide when to upgrade or downgrade based on what behavior you are expecting and a time/place of your choosing. You'll need to substitute the Google api key with the HERE app_id and app_code as you may have seen in other tutorials.

  • ?key=${GOOGLE_API_KEY}
  • ?app_id=${HERE_APP_ID}&app_code=${HERE_APP_CODE}

With the endpoint and authorization out of the way, we specify the parameters for the route we want. The Google Directions API to its credit accepts some flexible input parameters for origin and destination which can be an address doing the geolocation behind the scenes. If you use it this way and are migrating to HERE you'll need to make the geocoding request first to identify the latitude and longitude.  You can learn more about that in How-To Migrate from Google Places to HERE Geocoder.  

The HERE route API also requires a mode that specifies any constraints around the type of route you want returned.  You can find Transport Mode described in the documentation for the full range of options.

  • &origin=187+W+9th+St+Boston,+MA&destination=Gillette+Stadium
  • &waypoint0=42.332878,-71.052917&waypoint1=42.090963,-71.264316&mode=fastest;car;traffic;disabled

There are a few variations on how the HERE API accepts Waypoint Parameters but "geo" latitude and longitude is the default.  The HERE Maps API for JavaScript may be helpful if you are doing this in your JavaScript application and as you can see the parameters are similar.

Service Response

After updating your requests, you'll need to find the data of interest for your application in the response.

Let's say you are interested in a trip summary. This may include the distance and duration. You'll find them in the corresponding:

  • Google routes[0].legs.distance and routes[0].legs.duration
  • HERE response.route[0].summary.distance and response.route[0].summary.baseTime.

This same request of the HERE Routing services returns additional information you may find valuable in your application such as the trafficTime and flags indicating features of the route.

The driving directions for steps along the route can be found with:

* Google routes[0].legs.steps
* HERE response.route[0].leg

This is an example step from the driving plan, where the leg identifies a start, end, and a list to include each maneuver:

See the JavaScript API documentation for more on how Displaying a Route on the Map can be accomplished.  If you still haven't migrated your maps, also check out How-To Migrate from Google Map to HERE