Manage bookmarks

View inAndroidFormsUWPWPFWinUIiOSView on GitHub

Access and create bookmarks on a map.

Image of manage bookmarks

Use case

Bookmarks are used for easily storing and accessing saved locations on the map. Bookmarks are of interest in educational apps (e.g. touring historical sites) or more specifically, for a land management company wishing to visually monitor flood levels over time at a particular location. These locations can be saved as bookmarks and revisited easily each time their basemap data has been updated (e.g. working with up to date satellite imagery to monitor water levels).

How to use the sample

The map in the sample comes pre-populated with a set of bookmarks. To access a bookmark and move to that location, tap on a bookmark's name from the list. To add a bookmark, pan and/or zoom to a new location and tap on the 'Add Bookmark' button. Enter a unique name for the bookmark and tap ok, and the bookmark will be added to the list

How it works

  1. Instantiate a new Map object and create a BookmarkList with map.Bookmarks.
  2. To create a new bookmark and add it to the bookmark list:
    • Instantiate a new Bookmark object passing in text (the name of the bookmark) and a Viewpoint as parameters.
    • Add the new bookmark to the book mark list with BookmarkList.Add(bookmark).

Relevant API

  • Bookmark
  • BookmarkList
  • Viewpoint

Tags

bookmark, extent, location, zoom

Sample Code

ManageBookmarks.xamlManageBookmarks.xamlManageBookmarks.xaml.cs
Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage x:Class="ArcGISRuntime.Samples.ManageBookmarks.ManageBookmarks"
             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">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="auto" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
        <Grid Grid.Row="0">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="200" />
                <ColumnDefinition />
            </Grid.ColumnDefinitions>
            <Label Grid.Column="0"
                   HorizontalTextAlignment="Center"
                   Text="Go to:"
                   VerticalTextAlignment="Center" />
            <Picker x:Name="bookmarkPicker"
                    Grid.Column="1"
                    SelectedIndexChanged="BookmarkPicker_SelectedIndexChanged"
                    VerticalOptions="CenterAndExpand" />
            <Button x:Name="ButtonAddBookmark"
                    Grid.Column="2"
                    Clicked="ButtonAddBookmark_Clicked"
                    Text="New ..." />
        </Grid>
        <esriUI:MapView x:Name="MyMapView" Grid.Row="1" />
    </Grid>
</ContentPage>

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