Unable to Zoom the Map Without Rotating It in HERE Maps SDK
Symptoms
------------
Customers using HERE Maps SDK may report one or more of the following:
The map rotates when users perform zoom gestures.
The application should allow zooming only, but map orientation changes unexpectedly.
Users want the map locked to north-up orientation.
Two-finger gestures cause the map bearing to change during interaction.
The map should remain fixed while allowing pinch-to-zoom operations.
Answer
----------
To prevent map rotation while still allowing users to zoom in and out, configure the map camera's bearing range to a fixed value of 0 degrees. This locks the map orientation and disables bearing changes caused by rotation gestures.
This behaviour is available through the camera limits configuration in HERE Maps SDK for Android, iOS, and Flutter.
Root Cause
--------------
By default, HERE Maps SDK allows camera bearing changes through supported map gestures. When users perform multi-touch interactions, the map may rotate because the camera bearing is not restricted.
Impact
----------
Map orientation changes during user interactions.
Applications requiring a fixed north-up view may provide an inconsistent user experience.
Expected vs Unexpected Behaviour
------------------------------------
Expected Behaviour
Users can zoom the map.
Map orientation remains fixed at 0° (north-up).
Rotation gestures do not change the bearing.
Unexpected Behaviour
The map rotates when users zoom or perform multi-touch gestures.
Bearing changes even though the application requires a fixed orientation
Resolution
Android
// Get MapCameraLimits from the camera.
val mapCameraLimits = mapView.camera.limits
// Lock bearing to 0 degrees.
val angleRange = AngleRange(0.0, 0.0)
// Apply the bearing restriction.
mapCameraLimits.bearingRange = angleRange
Flutter
MapCameraLimits mapCameraLimits = hereMapController.camera.limits;
AngleRange angleRange = AngleRange(0.0, 0.0);
mapCameraLimits.bearingRange = angleRange;
iOS
let mapCameraLimit = mapView.camera.limits
let bearingRange = AngleRange(start: 0.0, extent: 0.0)
mapCameraLimit.bearingRange = bearingRange
Recommended Actions
-----------------------
1. Configure the camera bearing range during map initialisation.
2. Set both the start and end values to 0.0 to completely lock map rotation.
3. Verify gesture behaviour after applying the bearing restriction.
4. Use this configuration when a fixed north-up map experience is required.
Updated 3 days ago