ArcGIS Pro SDK 2.0: Open Geodatabase by path

1338
1
Jump to solution
07-03-2017 12:35 AM
MaxMax2
Occasional Contributor II

With ArcGIS Pro SDK 1.4 I could do this:

new Geodatabase(geodatabasePath)

where geodatabasePath can be path of FGDB or SDE file.

I know that now there are constructor overloads for FGDB and SDE. But the problem is that I don't know which database type will be presented by geodatabasePath.

How can I create an instance of the Geodatabase by path that can be either path of FGDB or SDE file? Or maybe there is some method that can say what geodatabase type presented by a path?

0 Kudos
1 Solution

Accepted Solutions
GKmieliauskas
Esri Regular Contributor

Hi Max

This is a peace of code from snippets (look at notes):

https://github.com/esri/arcgis-pro-sdk/wiki/ProSnippets-Raster 

// 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);

View solution in original post

1 Reply
GKmieliauskas
Esri Regular Contributor

Hi Max

This is a peace of code from snippets (look at notes):

https://github.com/esri/arcgis-pro-sdk/wiki/ProSnippets-Raster 

// 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);