Select to view content in your preferred language

SDELayer fails in simple case

2847
17
05-07-2010 06:49 AM
JohnCawley_III
Emerging Contributor
I am trying to register a very simple MSSql table (with a Geometry shape) as a feature class in ArcSDE using SDELayer, but am unable to do so. I am using ArcSDE 9.3.1 on a SQL Server 2008 database.

I start with a good feature class, Bldg, that has a single (MSSql Geometry) shape in it and which is viewable in ArcCat/ArcMap. Then from MSSql, I make a copy of the table/FC with "select * into sde.Bldg2 from sde.Bldg". (On an aside, I understand that user sde should not own user data, but will fix that later.)

Now I try to register this new table/FC with ArcSDE using this command:

sdelayer -o register -l Bldg2,shape -e na+ -t GEOMETRY -C objectid,SDE %auth

where %auth contains my connection and authentication information for user sde. I receive this error:

ArcSDE 9.3.1  for SQL Server Build 1632 Thu Feb 26 12:05:37  2009
Layer    Administration Utility
-----------------------------------------------------
Error: Invalid entity type (-29).
Error: Cannot Create Layer.

After I receive this error, Bldg2 does show up under ArcCat, but as a table, not a feature class.

I've searched the forums here and tried advice from somewhat-related problems, with no success. Thanks in advance for any assistance,
--John
0 Kudos
17 Replies
VinceAngelo
Esri Esteemed Contributor
Have you tried specifying coordinate reference parameters (-x/-G/-P or -R)?

I haven't worked much with GEOMETRY on SQL-Server 2008, but the Oracle
metadata includes envelope, projection, and resolution data which allows
for a better guess on coordref, before then passing the existing geometries
through validation.

Your invalid entiity type could be due to coordinate snapping to a single
vertex (or a two-point line), or the table could just have non-polygon features
which don't meet the "nil or polygon" entity flag mask.

- V
0 Kudos
EricPaitz
Esri Contributor
I assume that the building shape is a closed polygon and not a polyline? Is it a single part or multi part polygon? If so try (just as a test) to register with the entity type as area only. Dont worry about n for nil and + for multi-part.

sdelayer -o register -l Bldg2,shape -e a -t GEOMETRY -C objectid,SDE %auth
0 Kudos
JohnCawley_III
Emerging Contributor
Thanks for your replies!

I tried specifying the srid and "basic" coordinate precision (in case the sdelayer register command was trying to round nearby points to the same point):

sdelayer -o register -l zBldg2,shape -e na+ -t GEOMETRY -C objectid,SDE %auth -R 54 -P basic

This gave the same error "Invalid entity type (-29)", but on a minor note, it did not create a table with the same name afterward.

To keep things simple, I have only a single feature in the feature class, a closed single-part polygon -- the WKT, for example, is:

POLYGON ((-8899212.0936 4488955.4609000012, -8899222.9883 4488964.9522999972,
-8899254.6753 4488928.5802000016, -8899253.7593 4488927.7823000029,
-8899256.4052 4488924.7453000024, -8899268.3965 4488923.9197999984,
-8899271.4336 4488926.5656, -8899270.6356 4488927.4815, -8899307.0077 4488959.1684999987,
-8899316.4991 4488948.2736999989, -8899280.127 4488916.5868000016,
-8899279.3291 4488917.502700001, -8899276.292 4488914.8568999991,
-8899275.4665 4488902.8655000031, -8899266.4037 4488894.9699999988,
-8899254.4123 4488895.7955000028, -8899251.3752 4488893.1497000009,
-8899252.1732 4488892.2337, -8899215.8011 4488860.5468000025, -8899206.3097 4488871.4415000007,
-8899242.6818 4488903.1285, -8899243.4797 4488902.2126, -8899246.5168 4488904.8584000021,
-8899247.3423 4488916.8497999981, -8899244.6964 4488919.8867999986, -8899243.7805 4488919.0887999982,
-8899212.0936 4488955.4609000012))

My reasoning was that if I pulled this single shape from a good working feature class that ArcCat is already happy with (the Bldg FC that I copied the row from), it should be an easy, valid geometry to register.

I tried omitting  the nil and multipart portions from the entity type:

sdelayer -o register -l Bldg2,shape -e a -t GEOMETRY -C objectid,SDE %auth

This still gives the invalid entity type error, though.

Thanks,
--John
0 Kudos
VinceAngelo
Esri Esteemed Contributor
The ArcSDE 'C' API reports the same "Invalid shape type" error for that WKT.
I haven't been able to parse that vertex stream without error.

- V
0 Kudos
JohnCawley_III
Emerging Contributor
Hmm, it's a simple, non-overlapping polygon (looks like the NW, NE and SE legs of an "x"). The coordinates cluster around  -8899000, 4488000, which I don't think should be invalid -- it displays okay in the MSSql Spatial Results tab. It has SRID 54, which sde.sde_spatial_references lists as Web Mercator:

PROJCS["WGS_1984_Web_Mercator_Auxiliary_Sphere",GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Mercator_Auxiliary_Sphere"],PARAMETER["False_Easting",0.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",0.0],PARAMETER["Standard_Parallel_1",0.0],PARAMETER["Auxiliary_Sphere_Type",0.0],UNIT["Meter",1.0]]

And like I mentioned, ArcSDE seems to be happy enough with the identical shape in another FC.

Any ideas what ArcSDE may not like about it?

Thanks,
--John
0 Kudos
VinceAngelo
Esri Esteemed Contributor
Okay, I goofed -- my metadata file contained "np" eflags, which generated the error.

The coordinate system (projection) doesn't matter, but the falsex/falsey/xyunits matter
a great deal.  What values do they contain in SRID 54?  I used -10000000,0,10000 (with
HIGH precision).

Go ahead and leave your eflags at "na+", since that's not the issue.

- V
0 Kudos
JohnCawley_III
Emerging Contributor
From sde.sde_spatial_references:
    falsex = -20037700
    falsey = -30241100
    xyunits = 10000
0 Kudos
JohnCawley_III
Emerging Contributor
Also, just tried sdelayer register with the -x arg and the values for srid 54:

sdelayer -o register -l zBldg2,shape -e na+ -t GEOMETRY -C objectid,SDE %auth -x -20037700,-30241100,10000

but this still gives the invalid entity type error
0 Kudos
VinceAngelo
Esri Esteemed Contributor
Try again with "-P HIGH"  -- your Y origin is too far away with BASIC precision.

- V

PS: You'll also need "-G  102100" for  PE_PCS_WGS_1984_WEB_MERCATOR_AUXSPHERE
0 Kudos