Introduction to spans parameter

Introduction to spans parameter

0:00 - 00:22 Introduction

00:24 - 01:19 Routing response structure in v7

01:20 - 03:09 Routing response structure in v8

03:10 - 03:44 Sample usecase

03:45 - 05:12 Comparison between v7 and v8 for a usecase

05:13 - 06:58 Spans parameter

06:59 - 07:19 User Guide

Introduction

Welcome to the migration learning series. In this video, we will talk about one of the important changes in the Routing API request and response structure ie. Spans parameter.

Request & Response Structure

Routing Response in Routing v7 was structured to be Route -> Leg -> Maneuver -> Link bookended by meta info and route summary info.

In Routing v8 the response is structured to be Routes -> sections and meta info. Inside each section actions, summary, polyline (Geometry), notices, and spans (if requested) are nested.

When more detailed attributes about a section is required, then we can request spans. The travel portion of a section is split into spans. The split is made whenever there is a change in the value.

Demo Use Case

Let’s see an example in our routing demo tool: demo.routing.ext.here.com

We have a use case to get the length info by country for a route. In Routing V7 you would have used the Route Attribute Summary by Country to get this info. In Routing V8 whereas you would use spans for this purpose, and you must request for country code and length to get this data.

Request:
GET https://router.hereapi.com/v8/routes?apikey=YOUR_API_KEY&origin=48.7081,21.2808&destination=45.6377,13.7544&return=polyline,summary,actions,instructions&spans=countryCode,length,typicalDuration&transportMode=truck&routingMode=fast&departureTime=any 

Once I click on submit , I will be able to see my route generated with the response details on my right.

Similarly, you can see multiple use cases in the Developer Guide.

Hope you found this video useful. Thank you.

Generic Resources

Important place to visit for all other generic help.