I have constructed the Spatial Reference and Coordinate system for a new FeatureClass. I have set the extent of the FeatureClass and use the same spatial reference for features when I add them to the FeatureClass.

I set the FeatureClass domain by:

ISpatialReference pSpatRef;
ISpatialReferenceFactory pSpatialFactory = new SpatialReferenceEnvironment();
IGeographicCoordinateSystem pCoord =
pCoord.SetDomain(Math.Floor(XMin), Math.Ceiling(XMax), Math.Floor(YMin),
pSpatRef = pCoord as ISpatialReference;

I have verified that the Domain is set properly by looking at the Feature class's properties.

I would like to insert the new features using IFeatureCursor with IFeatureBuffer.

My code for doing this is:

 IFeatureCursor pCursor = pGPXFeatureClass.Insert(true);
 IFeatureBuffer pBuffer = pGPXFeatureClass.CreateFeatureBuffer();

 foreach (string fileName in fileList)
     GPXtoPolyline parseGPX = new GPXtoPolyline();
     parseGPX.GPXParser(fileName, pSpatRef);

     ///find the index of the name and shape attributes
     int intNameIndex = pGPXFeatureClass.FindField("Name");
     int intShapeIndex = pGPXFeatureClass.FindField("Shape");

     pBuffer.set_Value(intNameIndex, parseGPX.strName);

Here is my problem. When I run my procedure without using the SetDomain method it works without fault. However, when I use the SetDomain method, I get the following error:

An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in GEOG489_FinalProject_PGW.dll

Additional information: TabletPC inking error code. Queue is full (Exception from HRESULT: 0x80040238)

This error is triggered by the command:

pBuffer.Shape = parseGPX.pPolylineGeometry;

What is the cause of this error?

  • 2
    Generally a feature class extent is defined "automatically" by its contents. Are you attempting to create a new type of spatial reference here based on WGS 84 or simply assign WGS 84 to your feature class? SetDomain is used to modify the default bounds of the coordinate system itself, not features. – AHigh Mar 8 '17 at 0:27
  • 1
    Domain and extent are not related (except that the domain defines the limits of the extent). – Vince Mar 8 '17 at 0:52

The feature class extent is automatically managed by the contents, if you make changes (add or remove features) and wish to update the extents the correct interface is IFeatureClassManage with the UpdateExtent() method. You should only need to do this if you are creating (or removing) features within your program as editing the data manually will update the extents automatically.

When you create a feature class the default extent is the one set in the IGeometryDef (ISpatialReference.SetDomain) of the geometry column used in its creation, this will be overwritten as soon as the feature class contains features.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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