pe_zunit_from_prjfile |
Creates a linear unit object from the ZUNIT subcommand in an old-style PRJ file
PE_UNIT pe_zunit_from_prjfile (const char *path, int *error);
path | A pointer to a file that contains an old-style PRJ file |
error | A pointer to an error code |
Creates a PE linear unit object from the ZUNIT subcommand in 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
Zunit METERS Zone 11
Parameters
This file converts to the following PE linear unit string representation.
UNIT["Meter",1]]
Note: You need to include the pe_coordsys_from_prj.h header file to use this function.
On success, a linear unit object
PE_PRJ_CANNOT_OPEN_FILE The path
or file name is incorrect or does not exist.
PE_PRJ_ILLEGAL_ARGUMENT The pointer to the path
or file name is null or blank.
PE_PRJ_NO_ZUNIT
The zunit 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_UNIT lunit;
char *prjfile;
int err = 0;
char newstring[1024];
prjfile = "testutm.prj";
lunit = pe_zunit_from_prjfile(prjfile,&err);
if (err != 0)
{
printf("Error code = %d\n",err);
}
else
{
pe_unit_to_string(lunit,newstring);
printf("%s\n",newstring);
}