English

How To: Use persistent user-defined coordinate system objects with ArcSDE Java API

Summary

Persistent coordinate system and geographic (datum) transformation definitions can be defined with the projection engine and then used with the ArcSDE C API or the ArcSDE Java API. These can be a custom projected or geographic coordinate system or a modification of an existing projected or geographic coordinate system definition.

Procedure

Use the following procedure to set and use custom and persistent coordinate system (projection) IDs with ArcSDE Java API.

  1. Convert the custom coordinate system string into a comma delimited file and name it appropriately. For more details on naming, navigate to ArcSDE Developer Help > Development environments > C API > Programming Concepts > Coordinate systems and Projections > Using persistent user defined objects.

    PROJCS, GEOGCS, or GEOGTRAN strings cannot be used directly. This method of persisting user-defined coordinate systems or geographic transformations requires the use of the macro that are found in the pedef.h include file. This is the PROJCS string for the State Plane zone California 5, using US survey feet, and based upon NAD 1983:
    PROJCS"NAD_1983_StatePlane_California_V_FIPS_0405_Feet",
    GEOGCS["GCS_North_American_1983", DATUM["D_North_American_1983",
    SPHEROID"GRS_1980",6378137,298.257222101]], PRIMEM["Greenwich",0],
    UNIT["Degree",0.0174532925199432955]],PROJECTION["Lambert_Conformal_Conic"],
    PARAMETER["False_Easting",6561666.666666666],PARAMETER["False_Northing",1640416.666666667],
    PARAMETER["Central_Meridian",-118],PARAMETER["Standard_Parallel_1",34.03333333333333],
    PARAMETER["Standard_Parallel_2",35.46666666666667],PARAMETER["Latitude_Of_Origin",33.5],
    UNIT["Foot_US",0.304800609601219241]]

    Below is the same definition converted to use the macros. The entire GEOGCS portion is represented by a single macro, PE_GCS_NAD_1983:
    PROJCS,202001,"NAD_1983_StatePlane_California_V_FIPS_0405_Feet",
    PE_GCS_NAD_1983,PE_PRJ_LAMBERT_CONFORMAL_CONIC,PE_PAR_CENTRAL_MERIDIAN,-118.0,
    PE_PAR_STANDARD_PARALLEL_1,34.03333333333333,
    PE_PAR_STANDARD_PARALLEL_2,35.46666666666667,PE_PAR_LATITUDE_OF_ORIGIN,33.5,
    PE_PAR_FALSE_EASTING,6561666.666666666,PE_PAR_FALSE_NORTHING,1640416.666666667,PE_U_FOOT_US
  2. Create a file and name it PeHome.Properties. This file should have a pointer to the folder where the file created in step 1 resides. The variable to use is PEOBJECTHOME; it should look similar to the following:
PEOBJEDITHOME=D:\\MyProfessional\\6-June-2005\\440612
  1. Use the custom ID as defined in step 1 in the java code.
int code = 23031;

PeProjectedCS projectedCS = null;
System.out.println(" Trying code="+code);

projectedCS = PeFactory.projcs(code);
System.out.println(" name=" + projectedCS.getName());
System.out.println(" string=" + projectedCS.toString());
  1. Include the path to PeHome.Properties in the classpath when running the code.