Marco M
Marco M

Reputation: 15

I cannot get the trafficService from platform

I'm trying to get the trafficService from H.service.Platform, but for some reason I can't

I'm following the documentation: https://developer.here.com/documentation/maps/topics_api/h-service-traffic-service.html

So I have a working H.service.Platform (that's working for sure, because i'm using the TrafficIncidentsService and zero problems).

But when I try to get the trafficService exaclty as described in the docs

let traffic = platform.getTrafficService();

All I got is an error

ERROR TypeError: platform.getTrafficService is not a function
at HereTrafficApiService.getTrafficFlow (here-traffic-api.service.ts:37)
at TrafficWidgetComponent.getApiData (traffic-widget.component.ts:219)
    at traffic-widget.component.ts:62
    at ZoneDelegate.invokeTask (zone-evergreen.js:391)
    at Object.onInvokeTask (core.js:34182)
    at ZoneDelegate.invokeTask (zone-evergreen.js:390)
    at Zone.runTask (zone-evergreen.js:168)
    at invokeTask (zone-evergreen.js:465)
    at ZoneTask.invoke (zone-evergreen.js:454)
    at timer (zone-evergreen.js:2650)```

Maybe i'm missing something but, if I look into the platform object from the inspector there is a getTrafficIncidentsService() but no getTrafficService() and i can't figure out why. Can someone help?

Upvotes: 1

Views: 70

Answers (1)

Tomas
Tomas

Reputation: 1887

If you're using version 3.0, then there is no service to show traffic flow tiles, as traffic flow tiles are part of MapTileService. Therefore:

version 3.0:

traffic tiles: platform.getMapTileService()

traffic incidents: platform.getTrafficIncidents()

version 3.1:

traffic tiles & incidents: platform.getTrafficService()

Upvotes: 1

Related Questions