Select to view content in your preferred language

Sde command to create feature class and import coordinate system

1015
8
01-24-2012 06:12 AM
sapnas
by
Frequent Contributor
Can someone please provide a sde command example to create feature class and apply coordinate system? thanks!
0 Kudos
8 Replies
JakeSkinner
Esri Esteemed Contributor
Currently, there is no command to create a feature class using the SDE commands.  You can find a reference to all SDE commands in the admincmdref.htm file located at:

C:\Program Files\ArcGIS\ArcSDE\Documentation\Admin_Cmd_Ref

What are you trying to accomplish?  There may be a solution using python, or some other procedure.
0 Kudos
sapnas
by
Frequent Contributor
I have always used arcobjects with arceditor license to  create feature class and apply desired spatial reference. But in my current scenario the user has arcengine license and sde binaries. The only way I can create feature class is by using sde commands. I was able to create feature class using "sdetable -o create" "sdelayer -o add " commands but I was unable to change coordinate system. Then I tried "sdeimport -o create" command to import the feature class from flat file but I was unable to change the coordinate system using "sdelayer -o alter" command. As a workaround  I deleted  and unregistered the layer from imported featureclass and reregistered it with the new srid to change the spatial reference which worked. But now the feature class does not have spatial index.
0 Kudos
VinceAngelo
Esri Esteemed Contributor
You can't apply a coordinate reference after the fact when using ArcSDE command-line utilities.

The same is not true for spatial index parameters -- you can change them at any time (see the
admin doc for 'sdelayer -o alter -g ...' and 'sdelayer -o {load_only_io | normal_io}')

If you have a file in SDEeXport format, then you can simply use the '-o create' option, which will
restore all aspects of the layer (except DBTUNE keyword, which must be specified or it will default
to DEFAULTS).

Even if you use command-line tools to load tables, they still won't register with the geodatabase
(and be available for featuredatasets, et.. al.), but they will be available as simple featureclasses.

- V
0 Kudos
JakeSkinner
Esri Esteemed Contributor
I was able to get this to work using the 'sdetable -o create', 'sdelayer -o add', and 'sdelayer -o alter'.  Ex:

Create a table:

sdetable -o create -t parcels -d "PIN string(20)" -D vector -u vector


Add a spatial column to the table including coordinate system:

sdelayer -o add -l parcels,shape -e a -G 32614 -D vector -u vector


Alter the coordinate system:

sdelayer -o alter -l parcels,shape -G 32618 -D vector -u vector


You should be able to alter the spatial index using the 'sdelayer -o alter' command:

sdelayer -o alter -l parcels,shape -g GRID,300,1000,5000 -D vector -u vector


I am currently using ArcSDE 10 SP3 and SQL Server 2008.
0 Kudos
sapnas
by
Frequent Contributor
JSkinn3
I could change the coordinate system using "sdelayer -o add" with SRID option but I couldnt insert any features to the feature class. let me rerun insert program and will post the error details.

Appreciate your help!!
0 Kudos
sapnas
by
Frequent Contributor
I'm unable to reproduce the error. But it seems to be working now. Anyway thanks for your time.
0 Kudos
sapnas
by
Frequent Contributor
I noticed that the featureclass is not registered with geodatabase. Please let me know if you happen to know any sde commands for registration. Thanks!
0 Kudos
sapnas
by
Frequent Contributor
I encountered "The coordinates or measures are out of bounds." error while setting geometry to the shape field of the feature class using arcobjects.
0 Kudos