Change basemap

View inAndroidFormsUWPWPFWinUIiOSView on GitHub

Change a map's basemap. A basemap is beneath all layers on a Map and is used to provide visual reference for the operational layers.

Image of change basemap

Use case

Basemaps should be selected contextually. For example, in maritime applications, it would be more appropriate to use a basemap of the world's oceans as opposed to a basemap of the world's streets.

How to use the sample

Use the drop down menu to select the active basemap from the list of available basemaps.

How it works

  1. Create an Map object.
  2. Set the map to the MapView object.
  3. Choose a new basemap type and set it on the map.

Relevant API

  • Basemap
  • Map
  • MapView

Tags

basemap, map

Sample Code

ChangeBasemap.xamlChangeBasemap.xamlChangeBasemap.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
<UserControl x:Class="ArcGISRuntime.WinUI.Samples.ChangeBasemap.ChangeBasemap"
             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 Style="{StaticResource BorderStyle}">
            <StackPanel>
                <TextBlock Margin="0,0,0,5"
                           HorizontalAlignment="Center"
                           FontWeight="SemiBold"
                           Text="Select a basemap"
                           TextWrapping="Wrap" />
                <ComboBox x:Name="BasemapChooser"
                          HorizontalAlignment="Stretch"
                          SelectionChanged="OnBasemapListSelectionChanged" />
            </StackPanel>
        </Border>
    </Grid>
</UserControl>

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