Thursday, December 6, 2007

Loading spatial data between layers with different spatial columns

If you create a feature class in ArcCatalog, the default spatial column name to store spatial data is automatically called SHAPE. There are some existing layers whose spatial column is called GEOMETRY. Sdelayer is capable of creating feature classes by specifying GEOMETRY as the spatial column.

How you do load spatial data from a layer with SHAPE column to a layer with GEOMETRY column? Let us examine the following options.

Option 1: Use sdeexport / sdeimport.

First use the following script to create an ArcSDE export file:
sdeexport -o create -l source_layer,shape -a all -f source.sdx -i 5151 -s sde_server -u user1 -p user1

Then use this script to import ArcSDE export data into the target layer:
sdeimport -o init -l destination_layer,geometry -f source.sdx -i 5151 -s sde_server -u user2 -p user2
Warning: SDEX's column "SHAPE" not found in target table.

Exactly as the warning message says, only the attribute data are loaded into the target layer. Geometry column is null for all loaded records.

If the append operation is used, it is the same thing, which makes sense:
sdeimport -o append -l destination_layer,geometry -f source.sdx -i 5151 -s sde_server -u user2 -p user2
Warning: SDEX's column "SHAPE" not found in target table.

So this option does not work.

Option 2: Use FME / Data Interoperability Extension.
FME is the spatial ETL (extract, transform and load) tool provided by Safe software from Surrey of British Columbia in Canada. Data Interoperability Extension is an extension in ArcGIS desktop package. It is FME actually. Matching SHAPE and GEOMETRY will do the job: load spatial data in SHAPE into GEOMETRY column.

Option 3: Use Simple Data Loader in ArcCatalog.

In the dialog of Simple Data Loader, it provides the option to match attribute columns, but no option to match the spatial column.

I will check it out tomorrow and write the result here.

Dec 08: I tried this today in ArcCatlog. Values in SHAPE column are loaded into GEOMETRY column. Since ArcCatalog is based on ArcObjects, it makes sense. Actually it can automatically match them.

Of course there are other options, such as writing an ArcObjects utility.