pe_zunit_from_prjstring |
Creates a linear unit object from an old-style PRJ file formatted as a string
PE_UNIT pe_zunit_from_prjstring (const char *string, int *error);
string | A pointer to a string created from an old-style PRJ file |
error | A pointer to an error code |
Creates a PE linear unit 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
Zunit METERS
Parameters
The following is the string representation of the PE linear unit object.
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.
On success, a linear unit object; otherwise, one of the following is returned:
PE_PRJ_ILLEGAL_ARGUMENT The pointer
to the PRJ string is null or blank.
PE_PRJ_NO_ZUNIT
The zunit does not exist in the PRJ file.
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.
PE_UNIT lunit;
/* Note: The prjstring cannot be modified because it is hardcoded. */
char *prjstring = "Projection UTM\nUnits METERS\nDatum WGS84\nZone
11\nZunit METERS\nParameters\n";
int err = 0;
char newstring[1024];
lunit = pe_zunit_from_prjstring(prjstring,&err);
if (err != 0)
{
printf("Error code = %d\n",err);
}
else
{
pe_unit_to_string(lunit,newstring);
printf("%s\n",newstring);
}