Display a web map.
Use case
For displaying web maps stored on ArcGIS Online.
How to use the sample
A web map can be selected from the drop-down list. On selection the web map displays in the map view.
How it works
- Create a
Portal
from the ArcGIS URL http://www.arcgis.com. - Create a
PortalItem
using the Portal and the web map ID:new PortalItem(portal, ID)
. - Create a
Map
using the portal item. - Set the map to the
MapView
.
Relevant API
- Map
- MapView
- Portal
- PortalItem
About the data
The web maps accessed by this sample show Geology for United States, Terrestrial Ecosystems of the World and Recent Hurricanes, Cyclones and Typhoons.
Tags
portal item, web map
Sample Code
<UserControl x:Class="ArcGISRuntime.WinUI.Samples.OpenMapURL.OpenMapURL"
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 FontWeight="SemiBold"
Text="Select a map."
TextAlignment="Center" />
<ComboBox x:Name="MapList"
HorizontalAlignment="Stretch"
SelectionChanged="MapSelectionChanged" />
</StackPanel>
</Border>
</Grid>
</UserControl>