Search code examples
here-api

Here Maps Api for Javascript 3.1 - Very Slow


Between Here Maps Api for Javascript version 3.1 and Here Maps Api for Javascript version 3 is a big difference. The loading time, zooming, routes displaying is much much slower , up to 3 times.

We are usisng the default settings, but even so, on half of our computers on which we used HERE version 3 we cannot use the new version 3.1. It is not loading (cannot be used).

What can be done? I cannot afford to change all the computer to another computers of last generation. Are there some settings which can be used to reduce the responsive time of the maps?


Solution

  • What you could do is to load legacy packages and use legacy rendering engine (no tilting/rotation, only raster base layer):

    load legacy core package:

    <!DOCTYPE html>
      <html>
        <head>
        .....
          <script src="https://js.api.here.com/v3/3.1/mapsjs-core-legacy.js" type="text/javascript" charset="utf-8"></script>
        .....
    

    create map with legacy rendering engine:

    // assuming platform is instantiated
    
    // Obtain the default map types from the platform object:
    let defaultLayers = platform.createDefaultLayers();
    
    let map = new H.Map(
        document.getElementById('mapContainer'),
        defaultLayers.raster.normal.map,
        {
          zoom: 10,
          center: { lat: 52.5, lng: 13.4 },
          engineType: H.map.render.RenderEngine.EngineType.P2D
        });
    

    by default, fractional zoom levels are enabled in 3.1, therefore to have crisp map it is recommended to disable it:

    //assuming that UI and mapevents behavior are instantiated
    
    // disable fractional zooming for Behavior
    behavior.disable(H.mapevents.Behavior.Feature.FRACTIONAL_ZOOM);
    
    // add H.ui.ZoomControl with the disabled fractional zooming
    var zoomControl = new H.ui.ZoomControl({fractionalZoom: false});
    ui.addControl('zoom', zoomControl);
    

    For more information check the Migration guide