Read a GeoPackage

This sample demonstrates how to open a GeoPackage file from the local file system and list the available GeoPackageRasters and GeoPackageFeatureTables from the GeoPackage. Users can add and remove the selected datasets as RasterLayers or FeatureLayers to the map.

Read layers from a GeoPackage

Instructions

Select a layer name in the Layers Not in the Map list and then click the Add Layer to Map button to add it to the map. Conversely to remove a layer from the map select a layer name in the Layers Not in the Map list and click the Remove Layer from Map button.

Note:

The GeoPackage will be downloaded from an ArcGIS Online portal automatically.

Code

<UserControl
    x:Class="ArcGISRuntime.UWP.Samples.ReadGeoPackage.ReadGeoPackage"
    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 Background="White" BorderBrush="Black" BorderThickness="1"
                HorizontalAlignment="Right" VerticalAlignment="Top"
                Margin="30" Padding="20" Width="375">
            <ScrollViewer>
                <StackPanel>
                    <TextBlock
                        Text="Select a layer name from 'Layers not in the map' and click 'Add layer'. To remove a layer from the map, select a layer from 'Layers in the map' and click 'Remove layer'."
                        Margin="0,0,0,10"
                        TextWrapping="Wrap" FontWeight="SemiBold" />
                    <TextBlock Text="Layers in the map"
                               FontWeight="Bold"
                               Margin="0,0,0,5" HorizontalAlignment="Center"
                               TextWrapping="Wrap" />
                    <ListBox x:Name="LayersInTheMap"
                             Margin="0,5,0,5" />
                    <Button Content="Remove layer"
                            HorizontalAlignment="Stretch"
                            Click="Button_RemoveLayerFromMap_Click" />
                    <TextBlock Text="Layers not in the map"
                               FontWeight="Bold"
                               Margin="0,10,0,5" HorizontalAlignment="Center"
                               TextWrapping="Wrap" />
                    <ListBox x:Name="LayersNotInTheMap"
                             Margin="0,5,0,5" />
                    <Button Content="Add layer"
                            HorizontalAlignment="Stretch"
                            Click="Button_AddLayerToMap_Click" />

                </StackPanel>
            </ScrollViewer>

        </Border>
    </Grid>

</UserControl>


In this topic
  1. Instructions
  2. Code