pe_coordsys_from_prjstring

Creates a coordinate system object from an old-style PRJ file formatted as a string

Usage syntax

PE_COORDSYS pe_coordsys_from_prjstring (const char *string, int *error);

Parameters
string A pointer to a string created from an old-style PRJ file
error A pointer to an error code
Description

This function creates a PE coordinate system object from an old-style PRJ file.

An old-style PRJ file is used by the coverage, grid, and TIN data formats. You can find the file, named prj.adf, in the dataset directory. Here is a sample PRJ file.

Projection UTM
Units METERS
Datum WGS84
Spheroid WGS84
Zone 11
Parameters

The following is the string representation (reformatted for display) of the PE coordinate system object.

PROJCS["WGS_1984_UTM_Zone_11N",
  GEOGCS["GCS_WGS_1984",
    DATUM["D_WGS_1984",
      SPHEROID["WGS_1984",6378137,298.257223563]],
    PRIMEM["Greenwich",0],
    UNIT["Degree",0.017453292519943295]],
PROJECTION["Transverse_Mercator"],
PARAMETER["False_Easting",500000],
PARAMETER["False_Northing",0],
PARAMETER["Central_Meridian",-117],
PARAMETER["Scale_Factor",0.9996],
PARAMETER["Latitude_Of_Origin",0],
UNIT["Meter",1]]

Note: You need to include the pe_coordsys_from_prj.h header file to use this function. This file is included with the ArcSDE SDK.

Returns

On success, a coordinate system object; otherwise, one of the following is returned:

   PE_PRJ_ILLEGAL_ARGUMENT     The pointer to the PRJ string is null or blank.
PE_PRJ_ILLEGAL_DATUM        The datum is incorrect or cannot be converted.
PE_PRJ_ILLEGAL_PARAMETER    One of the parameters is incorrect or cannot be converted.
PE_PRJ_ILLEGAL_PROJECTION   The map projection cannot be converted. PE may not support it.
PE_PRJ_ILLEGAL_SPHEROID     The spheroid is incorrect or cannot be converted.
PE_PRJ_ILLEGAL_UNIT         The unit is incorrect or cannot be converted.
PE_PRJ_ILLEGAL_ZONE         The zone is incorrect or cannot be converted.
PE_PRJ_OUT_OF_MEMORY        The string is not long enough or the system has run out of memory.
PE_PRJ_TOO_MANY_PARAMS      There are too many parameters in the PRJ string. The PRJ file is incorrect.

Examples

PE_COORDSYS coordsys;
/* Note: The prjstring cannot be modified because it is hardcoded. */
char *prjstring = "Projection UTM\nUnits METERS\nDatum WGS84\nZone 11\nParameters\n";
int err = 0;
char newstring[1024];
coordsys = pe_coordsys_from_prjstring(prjstring,&err);
if (err != 0)
{
   printf("Error code = %d\n",err);
}
else
{
   pe_coordsys_to_string(coordsys,newstring);
   printf("%s\n",newstring);
}