Open map URL

View inWPFUWPFormsiOSAndroid
View on GitHub
Sample viewer app

Display a web map.

Image of open map URL

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

  1. Create a Portal from the ArcGIS URL http://www.arcgis.com.
  2. Create a PortalItem using the Portal and the web map ID: new PortalItem(portal, ID).
  3. Create a Map using the portal item.
  4. 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

OpenMapURL.xamlOpenMapURL.xaml.cs
                       
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<UserControl
    x:Class="ArcGISRuntime.WPF.Samples.OpenMapURL.OpenMapURL"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:esri="http://schemas.esri.com/arcgis/runtime/2013"
    mc:Ignorable="d"
    d:DesignHeight="300" d:DesignWidth="300">

    <Grid>
        <esri:MapView x:Name="MyMapView" />
        <Border Style="{StaticResource BorderStyle}">
            <StackPanel>
                <TextBlock Text="Select a map."
                           TextWrapping="Wrap" TextAlignment="Center" FontWeight="Bold" />
                <ComboBox x:Name="MapsChooser"
                          Margin="0,5,0,0"
                          SelectionChanged="MapSelectionChanged" />
            </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.