This example calculates a route from the Fernsehturm at Panoramastraße in Berlin (52.5208°N, 13.4093°E) to Kurfürstendamm (52.5034°N, 13.3295°E) in the west of the city using Public Transit API v8, and displays it on the map. The calculation finds the fastest available route using public transport.

Code

Access to the Public Transit API service is obtained from the H.service.Platform by calling getPublicTransitService(). The getRoutes() method is used to calculate the fastest public transport route by passing in the relevant parameters as defined in Public Transit API. The styling and display of the response is under the control of the developer.