ERROR

The modified geometry must be a different geometry instance from the feature's original geometry (e.g., a copy or new instance)

Last Published: April 25, 2020

Error Message

A coding practice has been identified that could lead to geometric network inconsistencies, and the following error may be displayed as a result of guards against this coding practice that have been installed in ArcGIS 9.3.

"The modified geometry must be a different geometry instance from the feature's original geometry (e.g., a copy or new instance)"

The following is a summary of the coding practice: Getting the geometry of a feature through the IFeature.Shape property, updating the reference to the feature, and using that same reference to set the geometry to the feature, may cause geometric network inconsistencies.

Cause

The error is due to a fix that was made to guard against a coding practice, which could lead to geometric network inconsistencies.

Solution or Workaround

If the error is being raised through one of the core ArcGIS tools or commands with no custom code, contact Esri Technical Support so that a new incident can be created and the problem reproduced.

If the error is being raised through the use of custom code, modify a copy of the geometry instead of the geometry itself. This can be done through the use of IFeature.ShapeCopy instead of IFeature.Shape, so that a copy of the feature’s shape is modified.

The code example listed below shows the changes necessary to circumvent the error message.

Note:
The correct coding practice of using IFeature.ShapeCopy is being used, while the line that may cause the error to appear has been commented out.

Code:
pEditor.StartOperation

Set pEdLayers = pEditor
Set pFeatures = pEditor.EditSelection

pFeatures.Reset
Set pFeature = pFeatures.Next

Dim pGeom As IGeometry
'This line is incorrect
'Set pGeom = pFeature.Shape

'This is the correct way to access the geometry for modification
Set pGeom = pFeature.ShapeCopy

Dim pGeomColl As IGeometryCollection
Set pGeomColl = pGeom

Dim pPointColl As IPointCollection
Set pPointColl = pGeomColl

Dim pPoint1 As IPoint
Dim pPoint2 As IPoint

Set pPoint1 = Create_PointGeometry(-5959.167882, 5667307.034188)
Set pPoint2 = Create_PointGeometry(-5983.323227, 5667300.739636)

pPointColl.AddPoint pPoint1
pPointColl.AddPoint pPoint2

Set pFeature.Shape = pGeom
pFeature.Store

pEditor.StopOperation ("Update geometry of edge feature")

    Article ID:000010000

    Software:
    • ArcMap

    Get help from ArcGIS experts

    Contact technical support

    Download the Esri Support App

    Go to download options

    Discover more on this topic