Author and save a map

This samples demonstrates how to author and save a map as an ArcGIS portal item (web map). Saving a map to arcgis.com requires an ArcGIS Online login.

Author map (iOS)

Instructions

  1. Pan and zoom to the extent you would like for your map.
  2. Choose a basemap from the list of available basemaps.
  3. Choose one or more operational layers to include.
  4. Click 'Save ...' to apply your changes.
  5. Provide info for the new portal item, such as a Title, Description, and Tags.
  6. Click 'Save Map'.
  7. After successfully logging in to your ArcGIS Online account, the map will be saved to your default folder.
You can make additional changes, update the map, and then re-save to store changes in the portal item.

Code

<UserControl x:Class="ArcGISRuntime.WPF.Samples.AuthorMap.AuthorMap"
             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">
    <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="300"/>
                <ColumnDefinition/>
            </Grid.ColumnDefinitions>
            <Grid Grid.Column="0">
                <Grid.RowDefinitions>
                    <RowDefinition Height="120"/>
                    <RowDefinition Height="90"/>
                    <RowDefinition Height="110"/>
                    <RowDefinition Height="40"/>
                    <RowDefinition/>
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="115"/>
                    <ColumnDefinition/>
                </Grid.ColumnDefinitions>
                <TextBlock Text="Select a Basemap:"
                       VerticalAlignment="Top" HorizontalAlignment="Right"
                       Margin="10"/>
                <ListBox x:Name="BasemapListBox" 
                     Grid.Column="1"
                     VerticalAlignment="Top" HorizontalAlignment="Left"
                     Height="100" Width="150"
                     Margin="10"
                     SelectionChanged="BasemapSelectionChanged"/>
                <TextBlock Text="Choose Layers:"
                       VerticalAlignment="Top" HorizontalAlignment="Right"
                       Margin="10,0"
                       Grid.Row="1"/>
                <ListBox x:Name="OperationalLayerListBox"
                     SelectionMode="Multiple"
                     Grid.Row="1" Grid.Column="1"
                     VerticalAlignment="Top" HorizontalAlignment="Left"
                     Height="75" Width="150"
                     Margin="10,0"
                     SelectionChanged="OperationalLayerSelectionChanged">
                    <ListBox.ItemTemplate>
                        <DataTemplate>
                            <TextBlock Text="{Binding Key}"/>
                        </DataTemplate>
                    </ListBox.ItemTemplate>
                </ListBox>
                <TextBlock Grid.Row="2"
                       VerticalAlignment="Top" HorizontalAlignment="Right"
                       Margin="10,0"
                       Text="Initial Extent:"/>
                <StackPanel Orientation="Vertical"
                        Grid.Row="2" Grid.Column="1"
                        Margin="10,0,0,0"
                        Width="150">
                    <StackPanel Orientation="Horizontal"
                            Margin="0,3">
                        <TextBlock Text="X Min:"/>
                        <TextBox x:Name="XMinTextBox" 
                             Margin="6,0"
                             Width="80"
                             IsReadOnly="True"
                             Text=""/>
                    </StackPanel>
                    <StackPanel Orientation="Horizontal"
                            Margin="0,3">
                        <TextBlock Text="Y Min:"/>
                        <TextBox x:Name="YMinTextBox"
                             Margin="6,0"
                             Width="80"
                             IsReadOnly="True"
                             Text=""/>
                    </StackPanel>
                    <StackPanel Orientation="Horizontal"
                            Margin="0,3">
                        <TextBlock Text="X Max:"/>
                        <TextBox x:Name="XMaxTextBox" 
                             Margin="5,0"
                             Width="80"
                             IsReadOnly="True"
                             Text=""/>
                    </StackPanel>
                    <StackPanel Orientation="Horizontal"
                            Margin="0,3">
                        <TextBlock Text="Y Max:"/>
                        <TextBox x:Name="YMaxTextBox"
                             Margin="5,0"
                             Width="80"
                             IsReadOnly="True"
                             Text=""/>
                    </StackPanel>
                </StackPanel>
                <Button Content="New Map"                        
                    Grid.Row="3" Grid.ColumnSpan="2"
                    VerticalAlignment="Top" HorizontalAlignment="Center"
                    Width="120" Height="25"
                    Margin="10,0"
                    Click="ClearMapClicked"/>
            <Grid x:Name="SaveMapGrid" 
                  Grid.Row="4" Grid.ColumnSpan="2"
                  Visibility="Collapsed">
                <Grid.RowDefinitions>
                    <RowDefinition Height="40"/>
                    <RowDefinition Height="40"/>
                    <RowDefinition Height="40"/>
                    <RowDefinition Height="40"/>
                    <RowDefinition Height="60"/>
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="115"/>
                    <ColumnDefinition/>
                </Grid.ColumnDefinitions>
                <TextBlock VerticalAlignment="Bottom" HorizontalAlignment="Right"
                       Text="Title:"/>
                <TextBox x:Name="TitleTextBox" 
                     Grid.Row="0" Grid.Column="1"
                     VerticalAlignment="Bottom" HorizontalAlignment="Left"
                     Width="150"
                     Margin="10,0"
                     Text="My Map"/>
                <TextBlock Grid.Row="1"
                       VerticalAlignment="Top" HorizontalAlignment="Right"
                       Margin="0,10"
                       Text="Description:"/>
                <TextBox x:Name="DescriptionTextBox" 
                     Grid.Row="1" Grid.Column="1"
                     VerticalAlignment="Top" HorizontalAlignment="Left"
                     Width="150" Height="50"
                     Margin="10"
                     TextWrapping="Wrap"
                     Text="Authored and saved using ArcGIS Runtime SDK."/>
                <TextBlock Grid.Row="2"
                       VerticalAlignment="Top" HorizontalAlignment="Right"
                       Text="Tags:"/>
                <TextBox x:Name="TagsTextBox" 
                     Grid.Row="2" Grid.Column="1"
                     VerticalAlignment="Top" HorizontalAlignment="Left"
                     Width="150"
                     Margin="10,0"
                     Text="ArcGIS Runtime, Sample"/>
                <Button Grid.Row="3" Grid.ColumnSpan="2" IsEnabled="{Binding ElementName=MyMapView }"
                    Content="Save Map to Portal"
                    Width="170" Height="25"
                    Margin="10,0"
                    VerticalAlignment="Center" HorizontalAlignment="Center"
                    Click="SaveMapClicked"/>
                <ProgressBar x:Name="SaveProgressBar" 
                         Grid.Row="4" Grid.ColumnSpan="2"
                         Height="15"
                         IsIndeterminate="True" 
                         Visibility="Hidden"/>
            </Grid>
            <Grid x:Name="OAuthSettingsGrid" 
                  Grid.Row="4" Grid.ColumnSpan="2"
                  Visibility="Visible">
                <Grid.RowDefinitions>
                    <RowDefinition Height="60"/>
                    <RowDefinition Height="40"/>
                    <RowDefinition Height="40"/>
                    <RowDefinition Height="40"/>
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="115"/>
                    <ColumnDefinition/>
                </Grid.ColumnDefinitions>
                <TextBlock Grid.Row="0" Grid.ColumnSpan="2"
                       VerticalAlignment="Bottom" HorizontalAlignment="Center"
                       Text="OAuth Settings"/>
                <TextBlock Grid.Row="1" 
                       VerticalAlignment="Bottom" HorizontalAlignment="Right"
                       Text="Client ID:"/>
                <TextBox x:Name="ClientIdTextBox" 
                     Grid.Row="1" Grid.Column="1"
                     VerticalAlignment="Bottom" HorizontalAlignment="Left"
                     Width="150"
                     Margin="10,0"/>
                <TextBlock Grid.Row="2"
                       VerticalAlignment="Top" HorizontalAlignment="Right"
                       Margin="0,10"
                       Text="Redirect Url:"/>
                <TextBox x:Name="RedirectUrlTextBox" 
                     Grid.Row="2" Grid.Column="1"
                     VerticalAlignment="Top" HorizontalAlignment="Left"
                     Width="150"
                     Margin="10"/>
                <Button Grid.Row="3" Grid.ColumnSpan="2"
                    Content="Save OAuth Settings"
                    Width="170" Height="25"
                    Margin="10,0"
                    VerticalAlignment="Center" HorizontalAlignment="Center"
                    Click="SaveOAuthSettingsClicked"/>
            </Grid>
        </Grid>
            <esri:MapView x:Name="MyMapView"
                      Grid.Column="1"/>
        </Grid>
</UserControl>


In this topic
  1. Instructions
  2. Code