Geodatabases: Difference between revisions

From Wildsong
Jump to navigationJump to search
Brian Wilson (talk | contribs)
Brian Wilson (talk | contribs)
Line 62: Line 62:
I can't COPY a feature class using copy and paste? Lordie! There must be some other reason.
I can't COPY a feature class using copy and paste? Lordie! There must be some other reason.


'''Using the ArcToolbox Data Management Tools/Feature Class/Features/Copy Features tool worked fine.'''
'''Using the ArcToolbox "Copy Features" tool worked fine.''' This is inconvenient! But works.


==== Copying with GDAL ====
==== Copying with GDAL ====

Revision as of 00:19, 6 February 2013

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), also not documented. They come in several flavors, which are not compatible.

And they wonder why I get excited about open source GIS.

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.

ArcGIS 8.3 versions

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.

The obsolete "personal" version based on the MS Access ("Jet") database format

, and the newer FGDB version. These allow many of the same features as SDE for an individual user. 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.)

The "file geodatabase" comes in an obsolete version that won't work on Linux and won't work with GDAL, from 9.x. And a new version (I forget - 10.0 or 10.1) that is actually provided with an API so even though it's proprietary it's possible to build a version of GDAL that supports it.

ESRI is pushing the file geodatabase pretty hard these days.

It's not a 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.

Other than that it seemed to work pretty well.

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? Lordie! There must be some other reason.

Using the ArcToolbox "Copy Features" tool worked fine. This is inconvenient! But works.

Copying with GDAL

ogr2ogr

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 Raster data (ArcGIS 9.0+) --

Raster catalog -- You can have multiple rasters in a feature class, for example to store aerial photos when you don't want to create a mosaic.

Raster time series - you can have multiple rasters in a feature class ordered as layers and sorted by time; you can use the ordering to control how overlapping rasters are layered, too.

Relationship class: binds tables together; can contain additional 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.

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...

  1. In ArcCatalog, create a new GDB.
  2. 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.
  3. When you create the dataset, set its projection using the feature class you will use in the next step.
  4. 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