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;
wse.StartEditing(true);
wse.StartEditOperation();
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: http://support.esri.com/en/knowledgebase/techarticles/detail/16135
Solution: http://forums.esri.com/Thread.asp?c=159&f=1707&t=232881