How to open a Mobile Geodatabase?

260
1
12-17-2020 02:29 PM
KirkKuykendall1
Occasional Contributor III

Hi -

I get an exception trying to open a mobile geodatabase.

Is there a snippet for this somewhere?

Thanks, Kirk

 

public static void Test3()
{
    var mgdbPath = @"D:\nhd_data\Mobile2.geodatabase";
    if (!File.Exists(mgdbPath))
        throw new FileNotFoundException(mgdbPath);
    var cn = new DatabaseConnectionProperties(EnterpriseDatabaseType.SQLite)
    { 
        Database = mgdbPath //anything else to set??
    };

    using (var gdb = new Geodatabase(cn)) //exception here
    {
        var c = gdb.GetDefinitions<FeatureClassDefinition>().Count();
        Debug.Print($"count {c}");
    }
}

 

0 Kudos
1 Reply
RichRuh
Esri Regular Contributor

Hi Kirk,

The Pro SDK doesn't yet support directly opening mobile geodatabases.  You can get a feature class or table that comes from a mobile geodatabase by getting it from the map, and you can open a SQLite database as a Database using Database(SQLiteConnectionPath), but that doesn't give you the same capabilities.

We're hoping to get this into the next release of Pro.

Sorry I cannot help more,

--Rich

0 Kudos