Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have the following code that calls on a remote geodatabase server. Everything is connected and working, but when I try to add a point and use featureclass.CreateFeature();, it shuts down.

At first I realized it was esriMultiPoint, but I fixed this, I remade the command lines, and created the shp2sde again. And this time I can confirm the server says it is esriGeometryPoint.

IWorkspaceEdit wse = ws as IWorkspaceEdit;
Log.Write("Feature class=" + fClass.FeatureType.ToString() + " Fieldtype=" +fClass.ShapeType.ToString());
//Get a reference to the new point object
ESRI.ArcGIS.Geometry.IPoint com_point = (ESRI.ArcGIS.Geometry.IPoint)(serverContext.CreateObject("esriGeometry.Point"));
Log.Write("Create esriGeometryPoint");
((ESRI.ArcGIS.Geometry.IGeometry)com_point).SpatialReference = ((IGeoDataset)fClass).SpatialReference;
IGeometry geometry_point = com_point as IGeometry;
Log.Write("Check geometry point type=" + geometry_point.GeometryType);
//input coords 
object tempObj;
paraMap.TryGetValue("Longi", out tempObj);
com_point.X = double.Parse(tempObj.ToString());
paraMap.TryGetValue("Lati", out tempObj);
com_point.Y = double.Parse(tempObj.ToString());
Log.Write("about to create feature");
IFeature f = fClass.CreateFeature();
Log.Write("Create feature"); //CODE NEVER GETS HERE
f.Shape = com_point;

Here's my commandline to create the table in the database... (I put dots for excluding some info).

shp2sde -o create -l mynewdata3,shape -f C:\..bla.shp -a all -i sde:sqlserver:..... -C FID,SDE,1 -s ...... -D ...... -e p -u ..... -p ......

EDIT, should have used:

shp2sde -o create -l mynewdata3,shape -f C:..bla.shp -a all -i sde:sqlserver:..... -C FID,SDE,1 -s ...... -D ...... -e pn -u ..... -p ......

The log output and ERROR:

Feature class=esriFTSimple Fieldtype=esriGeometryPoint
Create esriGeometryPoint
Check geometry point type=esriGeometryPoint
about to create feature
at ESRI.ArcGIS.Geodatabase.IFeatureClass.CreateFeature()\r\n Shapes of this entity type not allowed in this layer

EDIT: I checked with logs and saw that the feature class being used, is correct feature class too.

EDIT 2: Solved

Details about the error:


share|improve this question
shp2sde - If you have an argis license, may I ask why are you creating the table using shp2sde? I know it is an ESRI command, but you will be facing much less pain if you did it with ArcObjects or GP. shp2sde does things at the arcsde level (instead of the GeoDatabase level) and I wouldn't be surprised if it was slightly messed up for your release. – Ragi Yaser Burhum Mar 20 '12 at 20:05
I have a limited Arc View license. So I can't administer my arcSDE database using ArcCatalog so I have to use command prompts. :S – Dexter Mar 20 '12 at 20:15
AFAIK, you can still use ArcObjects to connect to an enterprise GDB even with ArcView. It will not do a license check to block you from doing that. – Ragi Yaser Burhum Mar 21 '12 at 0:07
Ms and Zs also match? – Ragi Yaser Burhum Mar 21 '12 at 1:30
Yes I am connecting with ArcObject Geodatabase API to a database. Everything initializes. It's just the "CreateFeature" that's broken. Something must be wrong with my shapefile, I use a spreadsheet to create it and make an X,Y table. (Yes I don't include Ms/Zs). – Dexter Mar 21 '12 at 14:35
up vote 1 down vote accepted

Solved. The problem was that in the command line -e p was used. Which is a point.

However when you call createFeature:

IFeature f = fClass.CreateFeature();
Log.Write("Create feature"); //CODE NEVER GETS HERE
f.Shape = com_point;

the CreateFeature tries to create an empty record for shape. Which is not a point but a "null". So bad design by ESRI to not clarify such situations.

Just use sdelayer -o alter ....... -e pn in command prompt.

To modify your sde table to allow p and n types.

you can use sdelayer -o describe_long ...,...,,,,...

to check what types are allowed.

share|improve this answer
+1 this is good to know. Please mark your answer as accepted. – Kirk Kuykendall Mar 21 '12 at 20:23

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.