Select to view content in your preferred language

mapView.SetViewpoint looping for 5 to 25 minutes before setting

171
1
04-03-2025 07:06 AM
Labels (1)
AleksaSavic
New Contributor

I'm using mapView.SetViewpoint in a loop:

mapView.SetViewpoint(viewpoint);
while (mapView.DrawStatus == DrawStatus.InProgress && !mapView.IsNavigating)
{
    var loaded = mapView.Dispatcher.Invoke(() => mapView.IsLoaded);
    if (!loaded)
    {
        break;
    }

    mapView.SetViewpoint(viewpoint);
    await Task.Delay(200).ConfigureAwait(false);
}

In some scenarios it set viewpoint after 2-3 times, but in some other scenarios it needs 5 to 25 minutes of looping.
I noticed that when this code is called on "Albers" map projection it needs time. The map projection where is working fine is "Mercator". Do you perhaps know why it is taking so long and how it can be handled?

Thank you!

0 Kudos
1 Reply
dotMorten_esri
Esri Notable Contributor

What's the purpose of this code? I don't really see why you need to set the viewpoint over and over again? With a little more understanding of the scenario you're trying to solve, I might be able to advice a cleaner way to do it.

0 Kudos