English

Error: SE_INCOMPATIBLE_COORDREFS (-138)

Error Message

The error code -138 (incompatible coordrefs) occurs when you attempt to insert a shape into an ArcSDE layer which does not share the layer's exact coordref (coordinate reference) or if you try to compare two shapes which do not share the exact coordref. The phrase "exact coordref" means a coordinate reference (SE_COORDREF object) that is exactly the same.

This problem usually appears when running user-written ArcSDE C API code.

Cause

There are various causes of this error, some of them including:

1. Creating a new shape (which is comprised of a SE_COORDREF object) and attempting to insert this shape into an ArcSDE layer which has a different coordinate reference (SE_COORDREF).

2. Comparing two shapes that don't have the same coordinate reference (SE_COORDREF).

3. Performing a spatial filter on an ArcSDE layer that has a different coordinate reference (SE_COORDREF) than that of the filter shape.

Solution or Workaround

In creating a shape (SE_SHAPE object) to use in the above scenarios the only reliable method is to extract the coordinate reference (SE_COORDREF object) from the existing layer and use that coordinate reference to create the shape object. These steps are summarized as follows:

1. Use SE_connection_create() to connect to the SDE instance.

2. Use SE_coordref_create() to create a SE_COORDREF object.

3. Use SE_layerinfo_create() to create a SE_LAYERINFO object.

4. Use SE_layer_get_info() to populate the SE_LAYERINFO object with the layer info from the layer.

5. Use SE_layerinfo_get_coordref() to populate the SE_COORDREF object with the coordref from the SE_LAYERINFO object.

6. Use SE_shape_create() to create a new shape object using the SE_COORDREF object that you retrieved from the layer.

If you are creating a new ArcSDE layer and need to create a shape object to use for inserting new features into this new layer, you should follow these steps:

1. Use SE_connection_create() to connect to the SDE instance.

2. Use SE_coordref_create() to create a SE_COORDREF object.

3. Use SE_coordref_set_* functions to populate the SE_COORDREF object.

4. Use SE_layerinfo_create() to create a SE_LAYERINFO object.

5. Use SE_layerinfo_set_coordref() to set the coordref for the layer.

6. Use SE_layerinfo_set_* functions to populate the rest of the SE_LAYERINFO object.

7. Use SE_layer_create() to create the new layer using the SE_LAYERINFO object.

8. Use SE_layer_get_info() to re-populate the SE_LAYERINFO object with the layer info from the layer.

9. Use SE_layerinfo_get_coordref() to re-populate the SE_COORDREF object with the coordref from the SE_LAYERINFO object.

10. Use SE_shape_create() to create a new shape object using the coordref that you retrieved from the layer.