Creating a Feature Schema

FDO API

 
Creating a Feature Schema
 
 
 

This section describes the creation of the SampleFeatureSchema, which is the example feature schema described in the Schema Management chapter. It also describes the creation of the OGC980461FS schema, which is the schema defined in the OpenGIS project document 98-046r1.

FDO Provider for ArcSDE does not support the creation or destruction of feature schema (that is, does not support the FdoIApplySchema and FdoIDestroySchema commands.) However, it does support the FdoIDescribeSchema command. The intended use of FDO Provider for ArcSDE is to operate on already existing feature schemas. FDO Provider for ArcSDE supports inserting, selecting, updating, and deleting data in existing schemas.

You can use FDO Provider for ArcSDE to operate on a new feature schema. However, you must create the schema using ArcSDE tools. In particular you use the sdetable and sdelayer commands, which can be used to create a schema in any of the data store technologies used by ArcSDE. This part of the description is generic. Other parts of the description are specific to Oracle and to Windows XP because Oracle is the data store technology and Windows XP is the operating system for this exercise.

First, you must create an Oracle username for the feature schema (that is, the name of the Oracle user is the name of the feature schema.) To do this, you connect as system administrator to the Oracle instance used by the ArcSDE server. The following command creates the user and grants to that user the privileges necessary for the ArcSDE tool commands to succeed:

grant connect,resource to <schemaName> identified by <password>

Secondly, you must log in to the host where the ArcSDE server is running. ArcSDE tools are on the host machine where the ArcSDE server resides.

TipNetMeeting can be used to remotely login to where the ArcSDE Server is running and launch a command window (that is, in the Run dialog box, enter cmd) The ArcSDE tool commands can be executed through the command window. Do not use C:\WINDOWS\SYSTEM32\COMMAND.COM because the line buffer is too short to contain the entire text of some of the SDE tool command strings.

Finally, execute the sdetable and sdelayer commands in a command window to create each of the classes. Since you are executing these commands on the host where the ArcSDE server is located, you can omit the server name option. If the ArcSDE server is connected to only one data store, you can omit the service option. For more information about all of the ArcSDE commands, consult the ArcSDE Developer Help Guide.

SampleFeatureSchema

In this sample a feature schema called SampleFeatureSchema is created, which contains one feature class called SampleFeatureClass. This feature class has the following three properties:

  • An Int32 called SampleIdentityDataProperty.
  • A string called SampleNameDataProperty.
  • A polygon geometry called SampleGeometricProperty.

First, use the sdetable -o create command to add the integer and string properties to SampleFeatureClass. Then, use the sdetable -o alter_reg command to identify the SampleIdentityDataProperty as an identity property. Finally, use the sdelayer -o add command to add the geometric property to SampleFeatureClass. This assumes that only one ArcSDE server service is running so that the -i option is optional. The -i option takes a service name as an argument.

The sdetable -o create command can be invoked as follows:

sdetable -o create -t SampleFeatureClass -d “SampleIdentityDataProperty INTEGER(10), SampleNameDataProperty STRING(64)” -u SampleFeatureSchema -p test.

The -o option takes the command option name. The -d option takes the column definitions, which is a quoted list of column name/column type pairs delimited by commas. The -u option takes an Oracle database user name, which becomes the feature schema name. The -p option takes a password.

The sdetable -o alter_reg command is invoked as follows:

sdetable -o alter_reg -t SampleFeatureClass -c SampleIdentityDataProperty -C USER -u SampleFeatureSchema -p test

The -c option identifies the column name that will be the identity property. The -C option indicates whether SDE is supposed to generate the value or obtain it from the user. You will be prompted to confirm that you want to alter the registration of the table.

The sdelayer command is invoked as follows:

sdelayer -o add -l SampleFeatureClass,SampleGeometricProperty -E 0,0,100,50 -e a -u SampleFeatureSchema -p test

The -o option takes the command option name. The -l option identifies the table and column. The -E option identifies the extents; the arguments are <xmin,ymin,xmax,ymax>. The -e option identifies the geometry type with ‘a’ indicating an area shape.

OGC980461FS

This schema contains the ten classes defined in the OpenGIS Project Document 980946r1. The types of the properties belonging to the classes is similar to that of SampleFeatureClass, namely, an integer, a string, and a geometry. One difference is that the geometry in three of the classes is multipart. Two of them have MULTIPOLYGON geometries, and one of them has a MULTILINESTRING geometry. A multipart geometry is indicated by adding a ‘+’ to the entity argument to the -e option in the sdelayer command. A MULTIPOLYGON geometry is indicated by “-e a+”, and a MULTILINESTRING geometry is indicated by “-e l+”.

An ArcSDE table cannot have two geometries. This restriction impacts the definition of the buildings class, which has a POLYGON and a POINT geometry. We have chosen to add the POINT geometry. The OpenGIS 98-046r1 document defines one query that references building objects, and the POINT geometry supports this query.

NoteThe use of -E option in the sdelayer command defines the extents. The arguments are <xmin,ymin,xmax,ymax>. The values provided below ensure that you will not receive any “ordinate out of bounds” errors when inserting the 98046r1 data.

ArcSDE Commands That Define the OGC980461FS Classes

sdetable -o create -t lakes -d "fid integer(10), name string(64)" -u OGC980461FS -p test
sdetable -o alter_reg -t lakes -c fid -C user -u OGC980461FS -p test
sdelayer -o add -l lakes,shore -E 0,0,100,50 -e a -u OGC980461FS -p test
sdetable -o create -t road_segments -d "fid integer(10), name string(64), aliases string(64), num_lanes integer(10)" -u OGC980461FS -p test
sdetable -o alter_reg -t road_segments -c fid -C user -u OGC980461FS -p test
sdelayer -o add -l road_segments,centerline -E 0,0,100,50 -e l -u OGC980461FS -p test
sdetable -o create -t divided_routes -d "fid integer(10), name string(64), num_lanes integer(10)" -u OGC980461FS -p test
sdetable -o alter_reg -t divided_routes -c fid -C user -u OGC980461FS -p test
sdelayer -o add -l divided_routes,centerlines -E 0,0,100,50 -e l+ -u OGC980461FS -p test
sdetable -o create -t forests -d "fid integer(10), name string(64)" -u OGC980461FS -p test
sdetable -o alter_reg -t forests -c fid -C user -u OGC980461FS -p test
sdelayer -o add -l forests,boundary -E 0,0,100,50 -e a+ -u OGC980461FS -p test
sdetable -o create -t bridges -d "fid integer(10), name string(64)" -u OGC980461FS -p test
sdetable -o alter_reg -t bridges -c fid -C user -u OGC980461FS -p test
sdelayer -o add -l bridges,position -E 0,0,100,50 -e p -u OGC980461FS -p test
sdetable -o create -t streams -d "fid integer(10), name string(64)" -u OGC980461FS -p test
sdetable -o alter_reg -t streams -c fid -C user -u OGC980461FS -p test
sdelayer -o add -l streams,centerline -E 0,0,100,50 -e l -u OGC980461FS -p test
sdetable -o create -t buildings -d "fid integer(10), address string(64)" -u OGC980461FS -p test
sdetable -o alter_reg -t buildings -c fid -C user -u OGC980461FS -p test
sdelayer -o add -l buildings,position -E 0,0,100,50 -e p -u OGC980461FS -p test
sdetable -o create -t ponds -d "fid integer(10), name string(64), type string(64)" -u OGC980461FS -p test
sdetable -o alter_reg -t ponds -c fid -C user -u OGC980461FS -p test
sdelayer -o add -l ponds,shores -E 0,0,100,50 -e a+ -u OGC980461FS -p test
sdetable -o create -t named_places -d "fid integer(10), name string(64)" -u OGC980461FS -p test
sdetable -o alter_reg -t named_places -c fid -C user -u OGC980461FS -p test
sdelayer -o add -l named_places,boundary -E 0,0,100,50 -e a -u OGC980461FS -p test
sdetable -o create -t map_neatlines -d "fid integer(10)" -u OGC980461FS -p test
sdetable -o alter_reg -t map_neatlines -c fid -C user -u OGC980461FS -p test
sdelayer -o add -l map_neatlines,neatline -E 0,0,100,50 -e a -u OGC980461FS -p test