Geodatabases: Difference between revisions
Brian Wilson (talk | contribs) mNo edit summary |
Brian Wilson (talk | contribs) |
||
(12 intermediate revisions by the same user not shown) | |||
Line 6: | Line 6: | ||
More specifically, the variation known as the "personal geodatabase" (or PGDB). | More specifically, the variation known as the "personal geodatabase" (or PGDB). | ||
2011 update - Personal Geodatabases can now safely be considered obsolete. They will be around forever of course, but there is no longer a reason to create a new one. They are based on the MS Access database tables. They are not (officially) portable to other operating systems because of this. | 2011 update - Personal Geodatabases can now safely be considered obsolete. They will be around forever of course, but there is no longer a reason to create a new one. They are based on the MS Access database tables. They are not (officially) portable to other operating systems because of this. ESRI never documented them. | ||
Now we have File Geodatabases (FGDB), poorly documented. They come in several flavors, which are not compatible; be careful! Don't use the older version 9 format, they made huge improvements. There is an API now but it's proprietary. | |||
Now we have File Geodatabases (FGDB), | |||
=== Scope === | === Scope === | ||
Line 31: | Line 27: | ||
=== Two main types of ESRI geodatabase === | === Two main types of ESRI geodatabase === | ||
Multiuser Geodatabase | ==== Multiuser Geodatabase ==== | ||
Based on real databases (like Oracle, PostgreSQL, SQL Server) | |||
If you use ArcSDE-based geodatabases, you get version control and multiuser features. ArcSDE is the 'application tier'; a layer of software that contains the geospatial features required to implement a geodatabase on top of various backend databases (Oracle, SQL Server, DB2, etc) which might or might not have any builtin spatial features. | |||
As far as I can tell "version control" is to allow checkout and checkin of a portion of a spatial dataset so that more than one person can edit at the same time. Please correct me if I am wrong. I am new at this. | |||
==== File - based geodatabases ==== | |||
There several flavors. | |||
'''Personal GeoDatabase''' (do not use, it's obsolete) is based on the MS Access ("Jet") database format. No support for multiuser or versioned access. (In fact, I have seen Jet files blown apart if more than one user writes to it... I have heard people claim that multiuser access to Jet files is fine but my own bad experiences belie this.) | |||
'''File Geodatabase''' comes in a version 9.x (obsolete) format and 10.x. | |||
The OpenFileGDB driver in GDAL supports both. The ESRI-provided API only supports 10.x format. | |||
The FGDB is one file, it's actually a folder full of files, which makes back up and restore, shall we say, "more interesting". The folder contains a random number of files and since it's a closed standard we don't know what they are for or how to sync or back them up. | |||
==== I can't copy? ==== | |||
"The application is not licensed to create or modify schema for this type of data". | |||
I can't COPY a feature class using copy and paste? There must be some other reason. | |||
'''Using the ArcToolbox "Copy Features" tool worked fine.''' This is inconvenient! But works. | |||
==== Copying with GDAL ==== | |||
Read a FGDB and write to a shapefile | |||
ogr2ogr -f "ESRI Shapefile" centerlines.shp Transportation/Transportation.gdb Centerlines | |||
Read a GeoJSON file and write a shapefile | |||
ogr2ogr -f "ESRI Shapefile" oregon.shp oregon.geojson | |||
Using ogr2ogr, I was able to read a GeoJSON file containing building footprints and to load it into a shapefile. | |||
Loading into a FGDB failed. | |||
The ESRI tools could not read the JSON file at all. I was not able to export to JSON using ESRI tools, either. | |||
They fail to run and fail to give meaningful error messages. | |||
=== Terminology === | === Terminology === | ||
Line 56: | Line 91: | ||
Network | Network | ||
Survey data | Survey data | ||
[[Annotation]] -- | [[Annotation]] -- | ||
Line 73: | Line 101: | ||
XML (ArcGIS 9.0+) -- XML can be used to import and export data. The [http://downloads.esri.com/support/whitepapers/ao_/XML_Schema.pdf geodatabase XML schema] is documented on the ESRI site. | XML (ArcGIS 9.0+) -- XML can be used to import and export data. The [http://downloads.esri.com/support/whitepapers/ao_/XML_Schema.pdf geodatabase XML schema] is documented on the ESRI site. | ||
=== Rasters in geodatabases === | |||
See [[Raster data management]]. | |||
== Here we go == | == Here we go == |
Latest revision as of 23:31, 24 August 2018
This page was started long ago before the development of the ESRI File Geodatabase.
Introduction to Geodatabases
2006 - These are notes written as I attemot to learn to use ESRI geodatabases. More specifically, the variation known as the "personal geodatabase" (or PGDB).
2011 update - Personal Geodatabases can now safely be considered obsolete. They will be around forever of course, but there is no longer a reason to create a new one. They are based on the MS Access database tables. They are not (officially) portable to other operating systems because of this. ESRI never documented them.
Now we have File Geodatabases (FGDB), poorly documented. They come in several flavors, which are not compatible; be careful! Don't use the older version 9 format, they made huge improvements. There is an API now but it's proprietary.
Scope
I am not attempting to duplicate the ESRI documentation. As I learn new things about geodatabases, I will write about it here to help cement it more firmly in my head, and so that I can refer back to it later.
Links to ESRI geodatabase stuff
Datamodels Tips and Tricks (Make sure you check this page out...)
ArcGIS Desktop documentation The "Geodatabase Workbook" contains a quickstart guide and exercises. The "Building Geodatbases" book is more complete.
These two books are the sources for most of my knowledge of Geodatabases. There is also a book from ESRI Press "Designing Geodatabases" but you should really get the above (free) docs under your belt before looking at it.
Two main types of ESRI geodatabase
Multiuser Geodatabase
Based on real databases (like Oracle, PostgreSQL, SQL Server)
If you use ArcSDE-based geodatabases, you get version control and multiuser features. ArcSDE is the 'application tier'; a layer of software that contains the geospatial features required to implement a geodatabase on top of various backend databases (Oracle, SQL Server, DB2, etc) which might or might not have any builtin spatial features.
As far as I can tell "version control" is to allow checkout and checkin of a portion of a spatial dataset so that more than one person can edit at the same time. Please correct me if I am wrong. I am new at this.
File - based geodatabases
There several flavors.
Personal GeoDatabase (do not use, it's obsolete) is based on the MS Access ("Jet") database format. No support for multiuser or versioned access. (In fact, I have seen Jet files blown apart if more than one user writes to it... I have heard people claim that multiuser access to Jet files is fine but my own bad experiences belie this.)
File Geodatabase comes in a version 9.x (obsolete) format and 10.x. The OpenFileGDB driver in GDAL supports both. The ESRI-provided API only supports 10.x format.
The FGDB is one file, it's actually a folder full of files, which makes back up and restore, shall we say, "more interesting". The folder contains a random number of files and since it's a closed standard we don't know what they are for or how to sync or back them up.
I can't copy?
"The application is not licensed to create or modify schema for this type of data".
I can't COPY a feature class using copy and paste? There must be some other reason.
Using the ArcToolbox "Copy Features" tool worked fine. This is inconvenient! But works.
Copying with GDAL
Read a FGDB and write to a shapefile
ogr2ogr -f "ESRI Shapefile" centerlines.shp Transportation/Transportation.gdb Centerlines
Read a GeoJSON file and write a shapefile
ogr2ogr -f "ESRI Shapefile" oregon.shp oregon.geojson
Using ogr2ogr, I was able to read a GeoJSON file containing building footprints and to load it into a shapefile. Loading into a FGDB failed.
The ESRI tools could not read the JSON file at all. I was not able to export to JSON using ESRI tools, either. They fail to run and fail to give meaningful error messages.
Terminology
An informal Comparison of geodata formats
Data model: a template that you can use to build a geodatabase, including documentation and suggested feature classes and topology rules
Feature Dataset: Feature class(es) + topology + network objects A GDB can contain multiple Feature Datasets.
Feature Class: a table containing spatial data + attributes
Table: rows and columns of data; can contain spatial fields
Topology: rules defining requirements for data to be stored in a dataset
Geometric network: topology rules defining how spatial features are connected
Vector data -- Network Survey data
Annotation --
Metadata --
Tabular data --
Topology rules --
XML (ArcGIS 9.0+) -- XML can be used to import and export data. The geodatabase XML schema is documented on the ESRI site.
Rasters in geodatabases
Here we go
You can think of a GDB as simply a container into which you shove a bunch of shapefiles. That's fine, you can use them that way. But if you do, you are missing out on half the fun.
Shapefiles are actually very limited. When you are trying to use GIS to describe geospatial data, does one shapefile do it for you? No; you have to have a set of shapefiles, tied together by an ArcView project (MXD file) and some extra notes and documentation (in a file or on postit notes on your monitor frame.)
Tips and tricks
Establishing a spatial reference
The ESRI docs make it seem simple, and it is but you have to doo things in the right order. If you don't you will get import errors complaining about data exceeding the xy domain and things like that...
- In ArcCatalog, create a new GDB.
- Create a new feature dataset in the GDB. All feature classes in a feature dataset must have the same spatial reference so you have to define it before going on. You want the extent (the xy domain) to be big enough to accomodate any data you will ever put in this dataset.
- When you create the dataset, set its projection using the feature class you will use in the next step.
- Import the feature class, one that covers the entire study area and has the right projection. For example, if I am working with Florida counties I will use a polygon file containing boundaries for all counties in the state of Florida. ArcCatalog automatically makes the extent a little bigger than the extent of the imported file.
Importing CAD data
Using spatial adjustment tools
Attribute transfer
Topology rules
Utility Network Analyst -- Download more tools from the ArcScripts site
Geodatabase Designer 2 GD2 is set of tools to export and import geodatabase schema using XML. You can save the geometric network and then restore it after doing a data load; ArcCatalog forces you to drop any existing geo network to load new data so this tool lets you work around this.
CASE tools -- in ArcCatalog, tool->customize->commands -> Schema Wizard to generate a new geodatabase