Wednesday, October 14, 2015

Read ESRI File Gdodatabase (FileGDB) using GDAL & C#

If you are creating a new project- set up GDAL & C# environment as described here

Code snippet to read ESRI File Geo-database (FileGDB) using GDAL and C#. By default it uses GDAL's 'OpenFileGDB' (read only) driver with out any external dependencies. If you are interested in editing GDB feature class you should use 'FileGDB' (read-write) driver, which had dependency on ESRI's FGDB API SDK. The UCLA's internal testing showed that ESRI's FileGDB driver drags the performance than OpenFileGDB for read-only operation. So choose the driver according to your needs.

However, both GDAL drivers and ESRI's API do not support the raster dataset inside the GDB till date.

 public static void ReadEsriGdb(string gdbPath, string featureLayerName)  
     {  
       //Register the vector drivers  
       Ogr.RegisterAll();  
   
       //Reading the vector data  
       DataSource dataSource = Ogr.Open(gdbPath, 0);  
       Layer layer = dataSource.GetLayerByName(featureLayerName);  
          
     }  
   
     //call  
      ReadEsriGdb("gdbPath.gdb", "counties");  

C# , GDAL

0 comments :

Post a Comment

 

© 2011 GIS and Remote Sensing Tools, Tips and more .. ToS | Privacy Policy | Sitemap

About Me