Set the map view to a new viewpoint.
      
   
    
Use case
Programatically navigate to a specified location in the map or scene. Use this to focus on a particular point or area of interest.
How to use the sample
The map view has several methods for setting its current viewpoint. Select a viewpoint from the UI to see the viewpoint changed using that method.
How it works
- Create a new Mapobject and set it to theMapViewobject.
- Change the map's Viewpointusing one of the available methods:
- Use MapView.SetViewpointAsync()to pan to a viewpoint.
- Use MapView.SetViewpointCenterAsync()to center the viewpoint on aPoint.
- Use MyMapView.SetViewpointScaleAsync()to set a distance from the ground using a scale.
- Use MapView.SetViewpointGeometryAsync()to set the viewpoint to a givenGeometry.
Relevant API
- Geometry
- Map
- MapView
- Point
- Viewpoint
Additional information
Below are some other ways to set a viewpoint:
- SetViewpoint
- SetViewpointAsync
- SetViewpointCenterAsync
- SetViewpointGeometryAsync
- SetViewpointRotationAsync
- SetViewpointScaleAsync
Tags
animate, extent, pan, rotate, scale, view, zoom
Sample Code
<UserControl
    x:Class="ArcGIS.UWP.Samples.ChangeViewpoint.ChangeViewpoint"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:esriUI="using:Esri.ArcGISRuntime.UI.Controls">
    <Grid>
        <esriUI:MapView x:Name="MyMapView" />
        <Border Background="White" BorderBrush="Black" BorderThickness="1"
                HorizontalAlignment="Right" VerticalAlignment="Top"
                Margin="30" Padding="20" Width="375">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*" />
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition Width="*" />
                </Grid.ColumnDefinitions>
                <TextBlock Text="Use the buttons to compare the various ways of setting the viewpoint."
                           Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="3"
                           Margin="0,0,0,5"
                           TextWrapping="Wrap" FontWeight="SemiBold" />
                <Button Content="Geometry"
                        Grid.Row="1" Grid.Column="0"
                        Margin="0,10,0,0"
                        HorizontalAlignment="Stretch"
                        Click="OnButtonClick" />
                <Button Content="Center and Scale"
                        Grid.Row="1" Grid.Column="1"
                        Margin="5,10,0,0"
                        HorizontalAlignment="Stretch"
                        Click="OnButtonClick"
                        RelativePanel.RightOf="GeomButton" />
                <Button Content="Animate"
                        Grid.Row="1" Grid.Column="2"
                        Margin="5,10,0,0"
                        HorizontalAlignment="Stretch"
                        Click="OnButtonClick"
                        RelativePanel.RightOf="ScaleButton" />
            </Grid>
        </Border>
    </Grid>
</UserControl>