I'm getting this error sometimes when loading a HERE map with the satellite base layer:
Tangram [error]: Error for style group 'non-collision' for tile 13/16/15542/12554/15 Cannot read property 'retain' of undefined: TypeError: Cannot read property 'retain' of undefined
at https://js.api.here.com/v3/3.1/mapsjs-core.js:377:259708
at Array.forEach (<anonymous>)
at https://js.api.here.com/v3/3.1/mapsjs-core.js:377:259679
at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke (http://localhost:4200/polyfills.js:3508:26)
at Object.onInvoke (http://localhost:4200/vendor.js:64284:33)
at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke (http://localhost:4200/polyfills.js:3507:52)
at Zone.push../node_modules/zone.js/dist/zone.js.Zone.run (http://localhost:4200/polyfills.js:3267:43)
at http://localhost:4200/polyfills.js:4006:34
at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (http://localhost:4200/polyfills.js:3540:31)
at Object.onInvokeTask (http://localhost:4200/vendor.js:64275:33)
This prevents the tiles from loading at first. It doesn't happen everytime. About 3 out of 10 page loads. If pan or switch to defaultLayers.vector.normal.map layer it starts to load the tiles correctly.
I'm using Angular 7.2.15 and HERE API 3.1.
I'm initializing the map in the following way:
const platform = new H.service.Platform({ apikey: apiKey });
const defaultLayers = platform.createDefaultLayers();
const map = new H.Map(
elementRef.nativeElement, // elementRef:ElementRef from directive constructor
defaultLayers.raster.satellite.map,
{
zoom: 15,
center: {lat: 0, lng:0}
}
);
const behavior = new H.mapevents.Behavior(new H.mapevents.MapEvents(map));
const ui = new H.ui.UI(map);
const zoomControl = new H.ui.ZoomControl();
ui.addControl('zoom', zoomControl);
How can I load the map in satellite view without throwing this errors?
A possible issue for the behavior could be some HERE JS library being loaded after the web page is loaded. Try if adding the satellite layer later on in the code has a better response.