Feature layer (geodatabase)

View inWPFUWPFormsiOSAndroid
View on GitHub

Display features from a local geodatabase.

Image of feature layer geodatabase

Use case

Accessing data from a local geodatabase 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 local geodatabase when conducting signage inspections in rural areas with poor network coverage.

How it works

  1. Create a geodatabase using the provided local resource, new Geodatabase(geodatabaseResourceUrl).
  2. Wait for geodatabase to load.
  3. Get the 'Trailheads' GeodatabaseFeatureTable from the geodatabase, Geodatabase.GeodatabaseFeatureTable(tableName).
  4. Create feature layer using the table from above, new FeatureLayer(geodatabaseFeatureTable).
  5. Add feature layer to Map with Map.OperationalLayers.Add(featureLayer).

Relevant API

  • FeatureLayer
  • Geodatabase
  • GeodatabaseFeatureTable

Offline data

Additional information

One of the ArcGIS Runtime data set types that can be accessed via the local storage of the device (i.e. hard drive, flash drive, micro SD card, USB stick, etc.) is a mobile geodatabase. A mobile geodatabase can be provisioned for use in an ArcGIS Runtime application by ArcMap. The following provide some helpful tips on how to create a mobile geodatabase file:

In ArcMap, choose File > Share As > ArcGIS Runtime Content from the menu items to create the .geodatabase file (see the document: http://desktop.arcgis.com/en/arcmap/latest/map/working-with-arcmap/creating-arcgis-runtime-content.htm).

Note: You could also use the 'Services Pattern' and access the Geodatabase class via a Feature Service served up via ArcGIS Online or ArcGIS Enterprise. Instead of using the Geodatabase class to access the .geodatabase file on disk, you would use GeodatabaseSyncTask to point to a Uri instead.

Tags

geodatabase, mobile, offline

Sample Code

FeatureLayerGeodatabase.xamlFeatureLayerGeodatabase.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.FeatureLayerGeodatabase.FeatureLayerGeodatabase">
    <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.