Example: Connect to an ESRI GDB File Geodatabase


Example: Connect to an ESRI GDB File Geodatabase

In this topic we create a data source by connecting to an ESRI GDB file geodatabase.    The project we create will be used in the Example: Connect Through Manifold ODBC to a Third Party and Example: Connect LibreOffice Through Manifold to an ESRI GDB example topics.


The well-known American GIS company ESRI utilizes several different "geodatabase" formats for data, in three main types:  





File geodatabases are recommended by ESRI over personal databases and are becoming one of the most frequent formats used to publish spatial data for use by ESRI applications.   ESRI provides an SDK, used by Manifold, to connect to ESRI file geodatabases for read/write access.     The ESRI SDK is not thread-safe, so Manifold cannot utilize it for parallel computation, but even with that limitation it provides reasonably fast and reliable connection to ESRI file geodatabases using ESRI's own code.  


This topic utilizes a data set published by ESRI.   It illustrates a water distribution network in Naperville, Illinois, in the US.    Like most file geodatabases, the data is published in the form of a .zip file.   When unzipped the example creates a folder called WaterDistributionNetwork.gdb that is populated with over 160 files, the large number of files being characteristic of file geodatabases, which store various different parts of a data set, such as indexes, within separate files.   


Visiting the WaterDistributionNetwork.gdb folder in Windows Explorer we see the many files that comprise the data set.   




We pause for a moment to consider what has a more staggering impact on good taste: the idea of saving a single GIS project as 167 files, or the bloated ribbon interface used for Windows File Explorer.   


Lucky for us, Manifold requires no guesswork of which of those 167 files to use to connect to the GDB.   




We begin by launching Manifold.   To connect to the GDB we choose File - Create - New Data Source.




We enter Water as the name for the data source, choose File: gdb as the Type and then click the [...] Browse button to find and choose the file we will use as the Source.




We navigate to our folder where we have three file databases stored.    ESRI uses an unusual style of naming file geodatabase folders as if they were files, using a three-letter extension.  We double click the WaterDistributionNetwork.gdb folder to enter it.  Note that the files of type box is already loaded with GDB files, since Manifold knows from the preceding dialog we want to create a file: gdb data source.




Mercifully, Manifold filters out all of the 160+ files in the folder that are not gdb files and shows us the single file called gdb.   We click on the gdb file and then press Open.




Taking a moment to review that everything in the New Data Source dialog is as we want, we press Create Data Source.




Manifold instantly creates a new data source called Water in the project.  We click on the + box to expand the Water data source.




We click again to epand the WaterDistribution folder.  We see the GDB contains the various drawings and tables for those drawings that are in ESRI's WaterDistributionNetwork.gdb example.

Viewing a Drawing

We can work with the GDB as we could with any read/write data source in Manifold.




We scroll down to the wHydrant Drawing and double-click on it to open it.   This drawing shows all of the fire hydrants in Naperville as points.




Double-clicking the drawing's wHydrant table we see that it provides attributes for each of the hydrants.   Note that the SHAPE field provides the geometry data for each point as a Manifold geom.   The Manifold dataport for ESRI GDB file geodatabases automatically translates ESRI geometry into Manifold geometry to and from.  If we edit this field the changes made within the ESRI file geodatabase will be made in the native ESRI geometry formats.




To see where all this is located we create an imageserver data source, in this case Google Streets, using the procedure described in the Example: An Imageserver Tutorial topic.   We also create a map and then drag and drop the Google streets layer into that map.




Next, we drag and drop the wHydrant Drawing into the map.   One dot appears in default, gray point format within the US.   Zoomed out to where the entire world is in view one dot is the simplified view.




To zoom to the wHydrant Drawing data set we right-click on the wHydrant Drawing layer in the map and choose Zoom.  That will zoom the data set to fit.  




The dots cover up much of the underlying Google streets layer at first but if we zoom further in we can see that yes, indeed, the dots really do show the locations of fire hydrants in Naperville, Illinois.  We can see Naperville North High School in the view.

Using the Data

Absolutely anything we want to do with data in Manifold we can do with this linked data source.   Manifold's ESRI GDB file geodatabase is fully read/write.   We can work with the drawings and the table as if they were native drawings and tables within the Manifold project, or stored within some other Manifold project nested into this one as a data source.


For example, we can make selections.   We switch to the wHydrant table by clicking the table's tab.




We either use the Layers panel to hide columns to get the above, simpler display.  The LASTSERVICE field gives the date when each fire hydrant was last serviced.    We will select all fire hydrants that were last serviced in the year 2007.


To do that we click the Contents pane and choose the  Select panel.




We choose the Between template, the LASTSERVICE field as the Value and then enter the first #01/01/2007# and last #12/31/2007# day of the year in 2007 as the Lower bound and Upper bound.   We use SQL style notation for date values, with the date between # characters.


The moment we enter valid dates Manifold will preview the result of the Between template using blue preview color in the table.




To make that selection in the table we click the Replace Selection button.




We have selected all of the records for hydrants last serviced sometime in 2007.




The same selection automatically appears in the wHydrant Drawing layer in the map.




If we like, we can add another imageserver layer, such as a Google satellite layer.  Zooming in, we can see where the various hydrants are located.  In the illustration above we have used Style to format the points in green color and to increase the point size slightly, to make it easier to see hydrant locations against the satellite photo background.



Many files -  The very large number of files used in a file geodatabase, with essential elements of the data set being stored in separate files that must travel together for the data set to retain coherency, poses obvious risks for fragility.   It is wise when transferring a geodatabase to do like ESRI does, zipping all the files together into a single .zip file.   Given there are very many files involved, all of which must be synchronized, it is also highly unwise to attempt to  modify an ESRI file geodatabase using anything other than ESRI code.   Manifold uses ESRI's own SDK to interact with ESRI file geodatabases.  


Modern GDB vs Deprecated GDB - The ESRI SDK used by Manifold supports connections to ESRI's modern GDB file geodatabase format, in current use for some years.   Many years ago ESRI used an older GDB file geodatabase format that is no longer supported by the ESRI SDK.   Some GDB format data sets are still in circulation on the web that use the old GDB format.   To read those, use Manifold's ability to connect through the GDAL library to formats that GDAL supports.  


Before GDAL began offering the ESRI SDK as an option to read modern ESRI file geodatabases, a GDAL-written, reverse-engineered module could read some information from the older ESRI GDB file geodatabase formats.   The GDAL module is not perfect in that it is read-only and it cannot extract all data from all file geodatabases, but at least it can extract some, if not all, data in many cases.  Better than nothing! The step by step procedure to use GDAL is given in the Example: Connect to an ESRI GDB usng GDAL/OGR topic.


See Also





Web Servers


Contents Pane


Contents - Select




Example: Spectacular Images and Data from Web Servers - A must see topic providing a gallery of views illustrating how Manifold can use web servers such as imageservers and other free resources to provide a seemingly endless selection of spectacular background maps, satellite images and GIS data with nearly zero effort.


Example: An Imageserver Tutorial - An extensive tutorial showing step by step how to add new data sources that are imageservers, how to show them as layers in a map, how to create a new drawing that matches the projection of the map and how to trace over what is seen in an imageserver layer to create an area object in the drawing.


Example: Import ERDAS GIS with GDAL and Assign Coordinate System  - A multistep example that covers import of an unwieldy format using GDAL, followed by use of Assign Initial Coordinate System and Repair Initial Coordinate System to deal quickly with real-life complications.


Example: Create an ODBC Data Source with Windows - How to create an ODBC data source (a DSN) using dialogs built into Windows 10.


Example: Connect to Manifold from Release 8  - Step by step procedure to connect from Manifold System Release 8 to a Manifold .map file using Manifold's ODBC driver.


Example: Connect to an ESRI GDB usng GDAL/OGR  -  Instead of using Manifold's built-in ability to connect to modern ESRI GDB file geodatabases, use the Manifold GDAL/OGR dataport to take advantage of the GDAL library's ability to connect to deprecated GDB formats.


Example: Connect Through Manifold ODBC to a Third Party  - With Release 8, use an ODBC connection to a Manifold .map to connect through the .map project to a third party, external data source, an ESRI GDB file geodatabase.  We use Manifold facilities as an intermediary to give Release 8 capabilities it does not have on its own, to link into data stored within an ESRI file geodatabase.


Example: Connect LibreOffice Through Manifold to an ESRI GDB - A companion example topic to the Example: Connect Through Manifold ODBC to a Third Party  topic.  Shows how to connect LibreOffice Base, the database part of LIbreOffice, through Manifold to link an ESRI GDB file geodatabase table into LibreOffice.


Example: Connect to Manifold from QGIS - Step by step procedure to connect from QGIS 2.8.9 to a Manifold .map file using Manifold's ODBC driver.