Parameters
- path
- A valid path to a file geodatabase folder that ends with the .gdb extension.
FileGeodatabaseConnectionPath
class.Exception | Description |
---|---|
System.ArgumentNullException | path is null. |
System.ArgumentException | The path in path does not end with the .gdb extension. |
public async Task OpenFileGDB() { try { await ArcGIS.Desktop.Framework.Threading.Tasks.QueuedTask.Run(() => { // Opens a file geodatabase. This will open the geodatabase if the folder exists and contains a valid geodatabase. using ( Geodatabase geodatabase = new Geodatabase(new FileGeodatabaseConnectionPath(new Uri(@"C:\Data\LocalGovernment.gdb")))) { // Use the geodatabase. } }); } catch (GeodatabaseNotFoundOrOpenedException exception) { // Handle Exception. } }
// Create a FileGeodatabaseConnectionPath using the path to the gdb. Note: This can be a path to a .sde file. FileGeodatabaseConnectionPath geodatabaseConnectionPath = new FileGeodatabaseConnectionPath(new Uri(@"C:\Temp\rasters.gdb")); // Create a new Geodatabase object using the FileGeodatabaseConnectionPath. Geodatabase geodatabase = new Geodatabase(geodatabaseConnectionPath); // Open the raster dataset. RasterDataset gdbRasterDataset = geodatabase.OpenDataset<RasterDataset>("sample");
Target Platforms: Windows 11, Windows 10