Search code examples
flutterhere-api

HERE SDK Flutter : Smooth Camera + remove 3D building


We use heresdk-4.5.3.0-release for Flutter edition Navigate.

While a "Navigation", the map camera moves jerkily, it's not smooth like your official app on the "Here WeGo" Store.

As indicated in your documentation, we use "LocationEngine" to retrieve the position of the phone, and we inject a "VisualNavigator" in the "addLocationListener" function.

then, we have this kind of function to update the map (function found in your examples) :

  // Update location and rotation of map. Update location of arrow.
  void _updateMapView(HERE.GeoCoordinates currentGeoCoordinates, double bearingInDegrees) {
    HERE.MapCameraOrientationUpdate orientation = HERE.MapCameraOrientationUpdate.withDefaults();
    orientation.bearing = bearingInDegrees;
    orientation.tilt = 180.0;
    _hereMapController.camera.lookAtPointWithOrientationAndDistance(
      currentGeoCoordinates,
      orientation,
      100,
    );
    _navigationArrow.coordinates = currentGeoCoordinates;
  }

How can we have a smooth camera movement?

We are unable to remove the 3D buildings on the default map, how can we get a 2D map only. Thank you

UPDATE

About my concern with the fluidity of the camera, I tested to use directly this method "startRendering" in the class "VisualNavigator":

https://developer.here.com/documentation/flutter-sdk-navigate/4.5.1.0/api_reference/navigation/VisualNavigator/startRendering.html

With this implementation I can have a smooth navigation experience, however, I can't change the image of the "location marker" :(


Solution

  • To disable extruded buildings, use the setLayerState (https://developer.here.com/documentation/flutter-sdk-explore/4.5.1.0/api_reference/mapview/MapScene/setLayerState.html) from your MapView instance and set LayerState "hidded" for value MapScenLayers.extrudedBuildings (https://developer.here.com/documentation/flutter-sdk-explore/4.5.1.0/api_reference/mapview/MapSceneLayers/extrudedBuildings.html)