Feature layer (GeoPackage)

View inWPFUWPFormsiOSAndroid
View on GitHub

Display features from a local GeoPackage.

Image of feature layer geopackage

Use case

A GeoPackage is an OGC standard, making it useful when your project requires an open source data format or when other, non-ArcGIS systems may be creating the data. Accessing data from a local GeoPackage is useful when working in an environment that has an inconsistent internet connection or that does not have an internet connection at all. For example, a department of transportation field worker might source map data from a GeoPackage when conducting signage inspections in rural areas with poor network coverage.

How to use the sample

Pan and zoom around the map. View the data loaded from the geopackage.

How it works

  1. Create a GeoPackage passing the URI string into the constructor.
  2. Load the GeoPackage with GeoPackage.loadAsync
  3. When it's done loading, get the GeoPackageFeatureTable objects from the geopackage with geoPackage.getGeoPackageFeatureTables()
  4. Create a FeatureLayer(featureTable) for each feature table and add it to the map as an operational layer. Add each to the map as an operational layer with map.OperationalLayers.Add(featureLayer).

Relevant API

  • Map
  • FeatureLayer
  • GeoPackage
  • GeoPackageFeatureTable

Offline data

This sample downloads the following items from ArcGIS Online automatically:

  • Aurora, Colorado GeoPackage - GeoPackage with datasets that cover Aurora Colorado: Public art (points), Bike trails (lines), and Subdivisions (polygons), Airport noise (raster), Buildings (raster).

Tags

feature table, geopackage, gpkg, OGC, package, standards

Sample Code

FeatureLayerGeoPackage.xamlFeatureLayerGeoPackage.xaml.cs
        
1
2
3
4
5
6
7
8
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:esriUI="clr-namespace:Esri.ArcGISRuntime.Xamarin.Forms;assembly=Esri.ArcGISRuntime.Xamarin.Forms"
             xmlns:mapping="clr-namespace:Esri.ArcGISRuntime.Mapping;assembly=Esri.ArcGISRuntime"
             x:Class="ArcGISRuntime.Samples.FeatureLayerGeoPackage.FeatureLayerGeoPackage">
    <esriUI:MapView x:Name="MyMapView"/>
</ContentPage>

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