Hello,
I'm using below code to rotate the arcgis map to north-up mode. Where SBUMapView is my arcgis map. This takes longer time to rotate the map to north side. Please help how we can rotate the map within few seconds.
SBUMapView.SetViewpointRotationAsync(0);
SBUMapView.LocationDisplay.AutoPanMode = LocationDisplayAutoPanMode.Off;
The general method SetViewpointAsync(Viewpoint,Timespan) has an additional argument for time of the animation. To change only the rotation, you need to save your current Viewpoint, change it's rotation to 0, and set to it.
var currentViewpoint = GetCurrentViewpoint(ViewpointType.CenterAndScale);
var newViewpoint = new Viewpoint(currentViewpoint.TargetGeometry as MapPoint, currentViewpoint.TargetScale, 0);
await MyMapView.SetViewpointAsync(newViewpoint, TimeSpan.FromSeconds(sec));
where sec is the number of seconds.
Hello @MateuszZugaj,
Thank you for the reply. I tried this solution which is working fine on iOS but on android it is causing app crash. I have tried below code.
Device.BeginInvokeOnMainThread(async () =>
{
var currentViewpoint = SBUMapView.GetCurrentViewpoint(ViewpointType.CenterAndScale);
var newViewpoint = new Viewpoint(currentViewpoint.TargetGeometry as MapPoint, currentViewpoint.TargetScale, 0);
await SBUMapView.SetViewpointAsync(newViewpoint, TimeSpan.FromSeconds(5));
});
SBUMapView.LocationDisplay.AutoPanMode = LocationDisplayAutoPanMode.Off;
I don't know why it would be dependent on platform. The weakest point of my solution would be the currentViewpoint.TargetGeometry as MapPoint part, but I thought that TargetGeometry is guaranteed to have the type MapPoint.