Map initial extent

View inWPFUWPFormsiOSAndroid
View on GitHub

Display the map at an initial viewpoint representing a bounding geometry.

Image of map initial extent

Use case

Setting the initial viewpoint is useful when a user wishes to first load the map at a particular area of interest.

How to use the sample

When the sample loads, note that the map view opens at the initial viewpoint defined on the map.

How it works

  1. Instantiate a Map object.
  2. Instantiate a Viewpoint object using an Envelope object.
  3. Set the starting location of the map with map.InitialViewpoint.
  4. Set the map in the MapView.

Relevant API

  • Envelope
  • Map
  • MapView
  • Point
  • Viewpoint

Tags

extent, envelope, initial, viewpoint, zoom

Sample Code

SetInitialMapArea.xamlSetInitialMapArea.xaml.cs
          
1
2
3
4
5
6
7
8
9
10
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:esriUI="clr-namespace:Esri.ArcGISRuntime.Xamarin.Forms;assembly=Esri.ArcGISRuntime.Xamarin.Forms"
             xmlns:mapping="clr-namespace:Esri.ArcGISRuntime.Mapping;assembly=Esri.ArcGISRuntime"
             x:Class="ArcGISRuntime.Samples.SetInitialMapArea.SetInitialMapArea">
  <Grid>
    <esriUI:MapView x:Name="MyMapView"/>
  </Grid>
</ContentPage>

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.