chrislott

Insert data through SDE and Java API - GIVEN COORDINATE REFERENCES ARE INCOMPATIBLE

Discussion created by chrislott on Jul 1, 2010
Latest reply on Mar 21, 2011 by ckepler
I am writing to ask for help with using ArcSDE 9.3.1 and the ESRI Java API.  I get an exception when trying to copy rows from one feature class (table) to another in my code.

Background: we receive shapefiles from outside entities.  The shapefiles arrive with a variety of coordinate systems.  We perform some minimal transformations on the text attributes associated with each shape row, such as adding a text column or cleaning up contents of a text column.    We use the Java API to do these basic text transformations.  The only operation we have to perform on the shapes is a geographic transformation so the shapes conform to the following coordinate system and projection:

Projected coordinate system name: WGS_1984_Web_Mercator
Geographic coordinate system name: GCS_WGS_1984_Major_Auxiliary_Sphere

I hit a problem when attempting to copy rows including shapes from one table to another using the Java API, the following exception is thrown:
Failed on column shape: com.esri.sde.sdk.client.SeException:
   THE GIVEN COORDINATE REFERENCES ARE INCOMPATIBLE.

Here's more detail.  In this case, the original shapefile uses system GCS_North_American_1983.  I imported the shapefile to our PostgresQL database using ArcCatalog.  I can view it fine.  I show the output of sdelayer for the original table below.

Then I created a new table (feature class) to hold a version of the data in my desired coordinate system.  To do this in ArcCatalog I used ArcToolbox, Data Management Tools, Projections and Transforms, Feature, Project, and the following two geographic transformations:
1. NAD_1983_To_WGS_1984_5 (per ESRI KB article 24159)
2. WGS_1984_Major_Auxiliary_System_To_WGS_1984 (name is confusing; direction is determined by runtime needs)

The output looks acceptable in ArcCatalog again.  See below for the output of sdelayer for this new table.

Finally, I used the JavaAPI to read rows from the transformed table and write the rows including shapes to the target table.  This is when the exception happens. See below for the output of sdelayer for the target table.

I found some form posts discussing this problem, for example:
http://forums.esri.com/Thread.asp?c=2&f=1718&t=165731
but this is are old and not using ArcSDE 9.3.1 so I don't know how relevant. Some posts in the forums suggest that the SRID values are critical.  I would like to understand this better.

I strongly suspect I did something wrong in the geographic transformation.  Does anyone see an obvious error?  Please help, thank you!

---------------

sdelayer output for original feature class:

ArcSDE 9.3.1  for PostgreSQL Build 1632 Thu Feb 26 12:05:37  2009
Layer    Administration Utility
-----------------------------------------------------
Layer Description ....: <None>
Table Owner ..........: tableowner
Table Name ...........: origtable
Spatial Column .......: shape
Layer Id .............: 126
SRID .................: 2
Minimum Shape Id .....: 1
Offset ...............:
  falsex:       -400.000000
  falsey:       -400.000000
System Units .........: 1111948722.222223
Z Offset..............:          0.000000
Z Units ..............:          1.000000
Measure Offset .......: <None>
Measure Units ........: <None>
XY Cluster Tolerance .:          0.000000008983
Spatial Index ........:
  parameter:    SPIDX_RTREE
  exist:        Yes
  array form:   -2,0,0
Layer Envelope .......:
  minx:       -74.07879,        miny:        40.78883
  maxx:       -73.93781,        maxy:        40.91341
Entities .............: nac+
Layer Type ...........: Extended SQL Type
Creation Date ........: Wed Jun 30 14:56:14 2010
I/O Mode .............: NORMAL
Autolocking ..........: Enabled
Precision.............: High
User Privileges ......: SELECT, UPDATE, INSERT, DELETE
Coordinate System ....: GEOGCS["GCS_North_American_1983",DATUM["D_North_American_1983",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]]

Layer Configuration ..: DEFAULTS

---------------
sdelayer output for transformed version of original feature class:


ArcSDE 9.3.1  for PostgreSQL Build 1632 Thu Feb 26 12:05:37  2009
Layer    Administration Utility
-----------------------------------------------------
Layer Description ....: <None>
Table Owner ..........: tableowner
Table Name ...........: transformedtable
Spatial Column .......: shape
Layer Id .............: 127
SRID .................: 6
Minimum Shape Id .....: 1
Offset ...............:
  falsex:  -20037700.000000
  falsey:  -30241100.000000
System Units .........:      10000.000000
Z Offset..............:          0.000000
Z Units ..............:          1.000000
Measure Offset .......: <None>
Measure Units ........: <None>
XY Cluster Tolerance .:          0.001
Spatial Index ........:
  parameter:    SPIDX_RTREE
  exist:        Yes
  array form:   -2,0,0
Layer Envelope .......:
  minx:  -8246413.10690,        miny:   4981245.51130
  maxx:  -8230719.05790,        maxy:   4999578.96100
Entities .............: nac+
Layer Type ...........: Extended SQL Type
Creation Date ........: Wed Jun 30 15:09:11 2010
I/O Mode .............: NORMAL
Autolocking ..........: Enabled
Precision.............: High
User Privileges ......: SELECT, UPDATE, INSERT, DELETE
Coordinate System ....: PROJCS["WGS_1984_Web_Mercator",GEOGCS["GCS_WGS_1984_Major_Auxiliary_Sphere",DATUM["D_WGS_1984_Major_Auxiliary_Sphere",SPHEROID["WGS_1984_Major_Auxiliary_Sphere",6378137.0,0.0]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Mercator"],PARAMETER["False_Easting",0.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",0.0],PARAMETER["Standard_Parallel_1",0.0],UNIT["Meter",1.0]]

Layer Configuration ..: DEFAULTS

---------------

sdelayer output for target table:

ArcSDE 9.3.1  for PostgreSQL Build 1632 Thu Feb 26 12:05:37  2009
Layer    Administration Utility
-----------------------------------------------------
Layer Description ....: <None>
Table Owner ..........: tableowner
Table Name ...........: targettable
Spatial Column .......: shape
Layer Id .............: 122
SRID .................: 3
Minimum Shape Id .....: 1
Offset ...............:
  falsex:  -20037700.000000
  falsey:  -30241100.000000
System Units .........:      10000.000000
Z Offset..............:          0.000000
Z Units ..............:          1.000000
Measure Offset .......: <None>
Measure Units ........: <None>
XY Cluster Tolerance .:          0.001
Spatial Index ........:
  parameter:    SPIDX_RTREE
  exist:        Yes
  array form:   -2,0,0
Layer Envelope .......:
  minx:  -8246413.10690,        miny:   4981245.51130
  maxx:  -8230719.05790,        maxy:   4999578.96100
Entities .............: nac+
Layer Type ...........: Extended SQL Type
Creation Date ........: Wed Jun 30 14:53:44 2010
I/O Mode .............: NORMAL
Autolocking ..........: Enabled
Precision.............: High
User Privileges ......: SELECT, UPDATE, INSERT, DELETE
Coordinate System ....: PROJCS["WGS_1984_Web_Mercator",GEOGCS["GCS_WGS_1984_Major_Auxiliary_Sphere",DATUM["D_WGS_1984_Major_Auxiliary_Sphere",SPHEROID["WGS_1984_Major_Auxiliary_Sphere",6378137.0,0.0]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Mercator"],PARAMETER["False_Easting",0.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",0.0],PARAMETER["Standard_Parallel_1",0.0],UNIT["Meter",1.0]]

Layer Configuration ..: DEFAULTS

Outcomes