13
int leading_zeros = 0;
14
char Lat_Long_Sep = ' ';
15
Range Long_Range = _180_180;
16
long Lat_Long_Prec = Tenth_of_Second;
18
void Show_Leading_Zeros(int lz)
23
void Set_Separator(char sep)
28
void Set_Long_Range(Range range)
35
return (Lat_Long_Sep);
38
Range Get_Long_Range()
43
void Set_Lat_Long_Precision(long precis)
45
Lat_Long_Prec = precis;
49
SVC_Status String_to_Projection(const char *str, Coordinate_Type *val)
51
SVC_Status error_Code = SVC_Success;
52
/* Note: any name that is a substring of another name must come before that name */
53
if (strstr("GEODETIC", str))
57
else if (strstr("GEOREF", str))
61
else if (strstr("GEOCENTRIC", str))
65
else if (strstr("LOCAL CARTESIAN", str))
67
*val = Local_Cartesian;
69
else if (strstr("MILITARY GRID REFERENCE SYSTEM (MGRS)", str))
73
else if (strstr("UNITED STATES NATIONAL GRID (USNG)", str))
77
else if (strstr("MERCATOR", str))
81
else if (strstr("OBLIQUE MERCATOR", str))
83
*val = Oblique_Mercator;
85
else if (strstr("TRANSVERSE MERCATOR", str))
87
*val = Transverse_Mercator;
89
else if (strstr("UNIVERSAL TRANSVERSE MERCATOR (UTM)", str))
93
else if (strstr("STEREOGRAPHIC", str))
97
else if (strstr("POLAR STEREOGRAPHIC", str))
101
else if (strstr("UNIVERSAL POLAR STEREOGRAPHIC (UPS)", str))
105
else if (strstr("ALBERS EQUAL AREA CONIC", str))
107
*val = Albers_Equal_Area_Conic;
109
else if (strstr("AZIMUTHAL EQUIDISTANT", str))
111
*val = Azimuthal_Equidistant;
113
else if (strstr("BONNE", str))
117
else if (strstr("BRITISH NATIONAL GRID (BNG)", str))
121
else if (strstr("CASSINI", str))
125
else if (strstr("ECKERT IV", str))
129
else if (strstr("ECKERT VI", str))
133
else if (strstr("EQUIDISTANT CYLINDRICAL", str))
135
*val = Equidistant_Cylindrical;
137
else if (strstr("GLOBAL AREA REFERENCE SYSTEM (GARS)", str))
141
else if (strstr("GNOMONIC", str))
145
else if ((strstr("LAMBERT CONFORMAL CONIC", str)) ||
146
(strstr("LAMBERT CONFORMAL CONIC (2 PARALLEL)", str)))
148
*val = Lambert_Conformal_Conic_2;
150
else if (strstr("LAMBERT CONFORMAL CONIC (1 PARALLEL)", str))
152
*val = Lambert_Conformal_Conic_1;
154
else if (strstr("MILLER CYLINDRICAL", str))
156
*val = Miller_Cylindrical;
158
else if (strstr("MOLLWEIDE", str))
162
else if ((strstr("NEY'S (MODIFIED LAMBERT CONFORMAL CONIC)", str)) ||
163
(strstr("NEYS (MODIFIED LAMBERT CONFORMAL CONIC)", str)))
167
else if (strstr("NEW ZEALAND MAP GRID (NZMG)", str))
171
else if (strstr("ORTHOGRAPHIC", str))
175
else if (strstr("POLYCONIC", str))
179
else if (strstr("SINUSOIDAL", str))
183
else if (strstr("CYLINDRICAL EQUAL AREA", str))
185
*val = Cylindrical_Equal_Area;
187
else if (strstr("TRANSVERSE CYLINDRICAL EQUAL AREA", str))
189
*val = Transverse_Cylindrical_Equal_Area;
191
else if (strstr("VAN DER GRINTEN", str))
193
*val = Van_der_Grinten;
197
error_Code = SVC_Invalid_Projection_String;
204
SVC_Status Projection_to_String(const Coordinate_Type val, char str[32])
206
SVC_Status error_Code = SVC_Success;
212
strcpy(str, "Geodetic");
217
strcpy(str, "GEOREF");
222
strcpy(str, "Geocentric");
225
case Local_Cartesian:
227
strcpy(str, "Local Cartesian");
232
strcpy(str, "Military Grid Reference System (MGRS)");
237
strcpy(str, "United States National Grid (USNG)");
242
strcpy(str, "Universal Transverse Mercator (UTM)");
247
strcpy(str, "Universal Polar Stereographic (UPS)");
250
case Albers_Equal_Area_Conic:
252
strcpy(str, "Albers Equal Area Conic");
255
case Azimuthal_Equidistant:
257
strcpy(str, "Azimuthal Equidistant");
262
strcpy(str, "British National Grid (BNG)");
267
strcpy(str, "Bonne");
272
strcpy(str, "Cassini");
275
case Cylindrical_Equal_Area:
277
strcpy(str, "Cylindrical Equal Area");
282
strcpy(str, "Eckert IV");
287
strcpy(str, "Eckert VI");
290
case Equidistant_Cylindrical:
292
strcpy(str, "Equidistant Cylindrical");
297
strcpy(str, "Global Area Reference System (GARS)");
302
strcpy(str, "Gnomonic");
305
case Lambert_Conformal_Conic_1:
307
strcpy(str, "Lambert Conformal Conic (1 parallel)");
310
case Lambert_Conformal_Conic_2:
312
strcpy(str, "Lambert Conformal Conic (2 parallel)");
317
strcpy(str, "Mercator");
320
case Miller_Cylindrical:
322
strcpy(str, "Miller Cylindrical");
327
strcpy(str, "Mollweide");
332
strcpy(str, "Ney's (Modified Lambert Conformal Conic)");
337
strcpy(str, "New Zealand Map Grid (NZMG)");
340
case Oblique_Mercator:
342
strcpy(str, "Oblique Mercator");
347
strcpy(str, "Orthographic");
352
strcpy(str, "Polar Stereographic");
357
strcpy(str, "Polyconic");
362
strcpy(str, "Sinusoidal");
367
strcpy(str, "Stereographic");
370
case Transverse_Mercator:
372
strcpy(str, "Transverse Mercator");
375
case Transverse_Cylindrical_Equal_Area:
377
strcpy(str, "Transverse Cylindrical Equal Area");
380
case Van_der_Grinten:
382
strcpy(str, "Van der Grinten");
386
error_Code = SVC_Invalid_Projection_Value;
394
double Round_Meter(const double Value)
396
* The function Round Meter rounds the specified value, in meters, according to
397
* the current precision level.
398
* Value : Value to be rounded (input)
402
double divisor = 1.0;
408
switch (Lat_Long_Prec)
435
case Tenth_of_Second:
440
case Hundredth_of_Second:
445
case Thousandth_of_Second:
450
case Ten_Thousandth_of_Second:
458
avalue = fabs (Value / divisor);
459
fraction = modf (avalue, &ivalue);
460
ival = (long)(ivalue);
461
if ((fraction > 0.5) || ((fraction == 0.5) && (ival%2 == 1)))
463
result = (double)(ivalue * divisor * sign);
468
SVC_Status Meter_to_String(const double meters, char str[15])
470
SVC_Status error_Code = SVC_Success;
472
double meter_Value = Round_Meter(meters);
474
if (Lat_Long_Prec > 4)
475
if (sprintf(str, "%1.*lf",(int)(Lat_Long_Prec - 5), meter_Value) <= 0)
476
error_Code = SVC_Meter_to_String;
478
error_Code = SVC_Success;
480
if (sprintf(str, "%1.0lf", meter_Value) <= 0)
481
error_Code = SVC_Meter_to_String;
483
error_Code = SVC_Success;
489
SVC_Status Long_Meter_to_String(const double meters, char str[15])
491
SVC_Status error_Code = SVC_Success;
493
double meter_Value = Round_Meter(meters);
495
if (Lat_Long_Prec > 4)
496
if (sprintf(str, "%1.*lf",(int)(Lat_Long_Prec - 5), meter_Value) <= 0)
497
error_Code = SVC_Meter_to_String;
499
error_Code = SVC_Success;
501
if (sprintf(str, "%1.0lf", meter_Value) <= 0)
502
error_Code = SVC_Meter_to_String;
504
error_Code = SVC_Success;
510
SVC_Status String_to_Double(const char *str, double *val)
512
char *placeholder = NULL;
513
SVC_Status error_Code = SVC_Success;
516
if (Valid_Number(str))
518
*val = strtod(str,&placeholder);
526
long Valid_Number(const char *str)
535
length = strlen(str);
536
if ((i<length) && ((str[i] == '-') || (str[i] == '+')))
538
while (valid && (i < length))
540
if (!isdigit(str[i]))
542
if ((str[i] == '.') && !deci)
558
SVC_Status String_to_Long(const char *str, long *val)
560
long return_Parameter = 0;
561
char *placeholder = NULL;
562
SVC_Status error_Code = SVC_Success;
564
if (str && strlen(str))
566
return_Parameter = strtol(str, &placeholder, 10);
569
if ((return_Parameter == 0) && (placeholder == str))
571
error_Code = SVC_String_to_Long;
574
*val = return_Parameter;
579
long Valid_Coord(char *str, long Type)
581
long Decimal = false;
590
Length = strlen(str);
591
if ((Pos<Length) && ((str[Pos] == '-') || (str[Pos] == '+')))
596
while ((Pos < Length) && Valid)
608
else if (isdigit(str[Pos]))
612
else if ((str[Pos] == ' ') || (str[Pos] == '/') || (str[Pos] == ':'))
622
else if (isalpha(str[Pos]))
624
str[Pos] = (char)toupper(str[Pos]);
625
if ((((str[Pos] == 'N') || (str[Pos] == 'S')) && (Type == Lat_String))
626
|| (((str[Pos] == 'W') || (str[Pos] == 'E')) && (Type == Long_String)))
645
SVC_Status String_to_Longitude(const char *str, double *val)
647
SVC_Status error_Code = SVC_Success;
649
double degrees = 0.0;
650
double minutes = 0.0;
651
double seconds = 0.0;
653
char *reference_Pointer;
656
/* Longitudes may have the following format :
662
where these are defined as follows
663
P = optional plus/minus
664
D = degrees (up to three places)
665
M = minutes (up to two places)
666
S = seconds (up to two places)
667
F = floating-point precision (up to 6 places)
668
H = optional hemisphere (NSEW)
669
/ = separator character, one of ':' , '/' , ' '
673
reference_Pointer = strdup_(str);
674
parse_String = reference_Pointer;
675
if (Valid_Coord(reference_Pointer,Long_String))
677
if (parse_String[0] == '-')
682
next_Str = strtok(parse_String, ":/ ");
684
if (next_Str != NULL)
686
degrees = atof(next_Str);
689
next_Str = strtok(NULL, ":/ ");
691
if (next_Str != NULL)
693
minutes = atof(next_Str);
696
next_Str = strtok(NULL, ":/ ");
698
if (next_Str != NULL)
700
seconds = atof(next_Str);
703
if ((strchr(str, 'N') != NULL) ||
704
(strchr(str, 'S') != NULL))
706
error_Code = SVC_Inappropriate_Hemisphere;
709
if (((next_Str = strchr(str, 'E')) != NULL)
710
|| ((next_Str = strchr(str, 'e')) != NULL))
714
error_Code = SVC_Sign_and_Hemisphere;
717
if (next_Str[1] != '\0')
719
error_Code = SVC_Misplaced_Hemisphere;
723
if (((next_Str = strchr(str, 'W')) != NULL)
724
|| ((next_Str = strchr(str, 'w')) != NULL))
728
error_Code = SVC_Sign_and_Hemisphere;
731
if (next_Str[1] == '\0')
737
error_Code = SVC_Misplaced_Hemisphere;
741
if (seconds >= 60 || seconds < 0)
743
error_Code = SVC_Seconds_out_of_Bounds;
746
if (minutes >= 60 || minutes < 0)
748
error_Code = SVC_Minutes_out_of_Bounds;
751
if ((degrees == -180 || degrees == 360) &&
752
((minutes != 0) || (seconds != 0)))
754
error_Code = SVC_Minutes_or_Seconds_Overflow;
757
/* Convert DMS to fractional degrees */
758
*val = ( fabs(degrees) + (minutes / 60.0) + (seconds / 3600.0) ) * sign;
760
/* Convert longitude to be between -180 and 180 */
764
if ((*val > 360) || (*val < -180))
766
error_Code = SVC_Degrees_out_of_Bounds;
769
if (error_Code != SVC_Success)
774
free(reference_Pointer);
777
error_Code = SVC_Error;
780
}/* String_to_Longitude */
783
SVC_Status Longitude_to_String(const double in_longitude, char str[15],
784
boole use_NSEW, boole use_Minutes, boole use_Seconds)
785
{/* Longitude_to_String */
786
double degrees = 0.0;
788
char degrees_As_String[15];
789
long starting_Index = 0;
790
long ending_Index = 13;
791
SVC_Status error_Code = SVC_Success;
793
longitude = in_longitude;
794
if ((longitude > -0.00000001) && (longitude < 0.00000001))
798
strcpy(degrees_As_String," ");
804
degrees = fabs(longitude - 360);
806
degrees = fabs(longitude);
812
degrees = longitude + 360;
818
Degrees_to_String(degrees, °rees_As_String[1], use_Minutes, use_Seconds, Long_String);
819
ending_Index = strlen(°rees_As_String[1]) + 1;
827
if ((longitude > 180) || (longitude < 0))
828
degrees_As_String[ending_Index] = 'W';
830
degrees_As_String[ending_Index] = 'E';
834
if ((longitude > 180) || (longitude < 0))
836
degrees_As_String[0] = '-';
845
degrees_As_String[ending_Index] = 'E';
849
degrees_As_String[ending_Index+1] = '\0';
850
strcpy(str, °rees_As_String[starting_Index]);
855
void Round_DMS(double *val, long place)
861
temp = *val * pow(10,place);
863
fraction = modf(temp, &int_temp);
864
if (((temp - int_temp) > 0.5) ||
865
(((temp - int_temp) == 0.5) && (fmod(int_temp,2.0) == 1.0)))
866
*val = (int_temp + 1.0) / pow(10,place);
868
*val = int_temp / pow(10,place);
872
void Degrees_to_String(double degrees, char *str, boole use_Minutes, boole use_Seconds, long Type)
874
double minutes = 0.0;
875
double seconds = 0.0;
876
long integer_Degrees = 0;
877
long integer_Minutes = 0;
878
long integer_Seconds = 0;
881
if ((!use_Minutes) || (Lat_Long_Prec == 0))
882
{ /* Decimal Degrees */
883
Round_DMS(°rees, Lat_Long_Prec);
886
if(Type == Lat_String)
887
if(fabs(degrees) < 10)
888
sprintf(str,"0%1.*lf",(int)Lat_Long_Prec,degrees);
890
sprintf(str,"%1.*lf",(int)Lat_Long_Prec,degrees);
892
if(fabs(degrees) < 10)
893
sprintf(str,"00%1.*lf",(int)Lat_Long_Prec,degrees);
894
else if(fabs(degrees) < 100)
895
sprintf(str,"0%1.*lf",(int)Lat_Long_Prec,degrees);
897
sprintf(str,"%1.*lf",(int)Lat_Long_Prec,degrees);
900
sprintf(str,"%1.*lf",(int)Lat_Long_Prec,degrees);
902
else if ((use_Minutes && !use_Seconds) || (Lat_Long_Prec <= 2))
903
{ /* Degrees & Minutes */
904
integer_Degrees = (long)degrees;
905
minutes = (degrees - integer_Degrees) * 60.0;
906
Round_DMS(&minutes, Lat_Long_Prec - 2);
907
integer_Minutes = (long)minutes;
908
if (integer_Minutes >= 60)
910
integer_Minutes -= 60;
911
integer_Degrees += 1;
913
if (Lat_Long_Prec <= 2)
917
if(Type == Lat_String)
918
if(fabs(degrees) < 10)
919
j = sprintf(str,"0%ld%c",integer_Degrees,Lat_Long_Sep);
921
j = sprintf(str,"%ld%c",integer_Degrees,Lat_Long_Sep);
923
if(fabs(degrees) < 10)
924
j = sprintf(str,"00%ld%c",integer_Degrees,Lat_Long_Sep);
925
else if(fabs(degrees) < 100)
926
j = sprintf(str,"0%ld%c",integer_Degrees,Lat_Long_Sep);
928
j = sprintf(str,"%ld%c",integer_Degrees,Lat_Long_Sep);
930
if(integer_Minutes < 10)
931
j += sprintf(str + j,"0%ld",integer_Minutes);
933
j += sprintf(str + j,"%ld",integer_Minutes);
936
sprintf(str,"%ld%c%ld",integer_Degrees,Lat_Long_Sep,integer_Minutes);
944
if(Type == Lat_String)
945
if(fabs(degrees) < 10)
946
j = sprintf(str,"0%ld%c",integer_Degrees,Lat_Long_Sep);
948
j = sprintf(str,"%ld%c",integer_Degrees,Lat_Long_Sep);
950
if(fabs(degrees) < 10)
951
j = sprintf(str,"00%ld%c",integer_Degrees,Lat_Long_Sep);
952
else if(fabs(degrees) < 100)
953
j = sprintf(str,"0%ld%c",integer_Degrees,Lat_Long_Sep);
955
j = sprintf(str,"%ld%c",integer_Degrees,Lat_Long_Sep);
957
if(integer_Minutes < 10)
958
j += sprintf(str + j,"0%1.*lf",(int)Lat_Long_Prec-2,minutes);
960
j += sprintf(str + j,"%1.*lf",(int)Lat_Long_Prec-2,minutes);
963
sprintf(str,"%ld%c%1.*lf",integer_Degrees,Lat_Long_Sep,(int)Lat_Long_Prec-2,minutes);
967
{ /* Degrees, Minutes, & Seconds */
968
integer_Degrees = (long)degrees;
969
minutes = (degrees - integer_Degrees) * 60.0;
970
integer_Minutes = (long)minutes;
971
seconds = (minutes - integer_Minutes) * 60.0;
972
Round_DMS(&seconds, Lat_Long_Prec - 4);
973
integer_Seconds = (long)seconds;
974
if (integer_Seconds >= 60)
976
integer_Seconds -= 60;
977
integer_Minutes += 1;
978
if (integer_Minutes >= 60)
980
integer_Degrees += 1;
981
integer_Minutes -= 60;
985
if (Lat_Long_Prec <= 4)
989
if(Type == Lat_String)
990
if(fabs(degrees) < 10)
991
j = sprintf(str,"0%ld%c",integer_Degrees,Lat_Long_Sep);
993
j = sprintf(str,"%ld%c",integer_Degrees,Lat_Long_Sep);
995
if(fabs(degrees) < 10)
996
j = sprintf(str,"00%ld%c",integer_Degrees,Lat_Long_Sep);
997
else if(fabs(degrees) < 100)
998
j = sprintf(str,"0%ld%c",integer_Degrees,Lat_Long_Sep);
1000
j = sprintf(str,"%ld%c",integer_Degrees,Lat_Long_Sep);
1002
if(integer_Minutes < 10)
1003
j += sprintf(str + j,"0%ld%c",integer_Minutes,Lat_Long_Sep);
1005
j += sprintf(str + j,"%ld%c",integer_Minutes,Lat_Long_Sep);
1007
if(integer_Seconds < 10)
1008
j += sprintf(str + j,"0%ld",integer_Seconds);
1010
j += sprintf(str + j,"%ld",integer_Seconds);
1013
sprintf(str,"%ld%c%ld%c%ld",integer_Degrees,Lat_Long_Sep,integer_Minutes,Lat_Long_Sep,integer_Seconds);
1023
if(Type == Lat_String)
1024
if(fabs(degrees) < 10)
1025
j = sprintf(str,"0%ld%c",integer_Degrees,Lat_Long_Sep);
1027
j = sprintf(str,"%ld%c",integer_Degrees,Lat_Long_Sep);
1029
if(fabs(degrees) < 10)
1030
j = sprintf(str,"00%ld%c",integer_Degrees,Lat_Long_Sep);
1031
else if(fabs(degrees) < 100)
1032
j = sprintf(str,"0%ld%c",integer_Degrees,Lat_Long_Sep);
1034
j = sprintf(str,"%ld%c",integer_Degrees,Lat_Long_Sep);
1036
if(integer_Minutes < 10)
1037
j += sprintf(str + j,"0%ld%c",integer_Minutes,Lat_Long_Sep);
1039
j += sprintf(str + j,"%ld%c",integer_Minutes,Lat_Long_Sep);
1041
if(integer_Seconds < 10)
1042
j += sprintf(str + j,"0%1.*lf",(int)Lat_Long_Prec-4,seconds);
1044
j += sprintf(str + j,"%1.*lf",(int)Lat_Long_Prec-4,seconds);
1047
sprintf(str,"%ld%c%ld%c%1.*lf",integer_Degrees,Lat_Long_Sep,integer_Minutes,Lat_Long_Sep,(int)Lat_Long_Prec-4,seconds);
1053
SVC_Status String_to_Latitude(const char *str, double *val)
1055
SVC_Status error_Code = SVC_Success;
1057
double degrees = 0.0;
1058
double minutes = 0.0;
1059
double seconds = 0.0;
1061
char *reference_Pointer;
1064
/* Longitudes may have the following format :
1070
where these are defined as follows
1071
P = optional plus/minus
1072
D = degrees (up to two places)
1073
M = minutes (up to two places)
1074
S = seconds (up to two places)
1075
F = floating-point precision (up to 6 places)
1076
H = optional hemisphere (NSEW)
1077
/ = separator character, one of / : sp
1082
reference_Pointer = strdup_(str);
1083
parse_String = reference_Pointer;
1084
if (Valid_Coord(reference_Pointer,Lat_String))
1086
if (parse_String[0] == '-')
1091
next_Str = strtok(parse_String, ":/ ");
1093
if (next_Str != NULL)
1095
degrees = atof(next_Str);
1098
next_Str = strtok(NULL, ":/ ");
1100
if (next_Str != NULL)
1102
minutes = atof(next_Str);
1105
next_Str = strtok(NULL, ":/ ");
1107
if (next_Str != NULL)
1109
seconds = atof(next_Str);
1112
if ((strchr(str, 'W') != NULL) ||
1113
(strchr(str, 'E') != NULL))
1115
error_Code = SVC_Inappropriate_Hemisphere;
1118
if (((next_Str = strchr(str, 'N')) != NULL)
1119
|| ((next_Str = strchr(str, 'n')) != NULL))
1123
error_Code = SVC_Sign_and_Hemisphere;
1126
if (next_Str[1] != '\0')
1128
error_Code = SVC_Misplaced_Hemisphere;
1132
if (((next_Str = strchr(str, 'S')) != NULL)
1133
|| ((next_Str = strchr(str, 's')) != NULL))
1137
error_Code = SVC_Sign_and_Hemisphere;
1140
if (next_Str[1] == '\0')
1146
error_Code = SVC_Misplaced_Hemisphere;
1150
if (seconds >= 60 || seconds < 0)
1152
error_Code = SVC_Seconds_out_of_Bounds;
1155
if (minutes >= 60 || minutes < 0)
1157
error_Code = SVC_Minutes_out_of_Bounds;
1160
if (degrees < -90 || degrees > 90)
1162
error_Code = SVC_Degrees_out_of_Bounds;
1165
if ((degrees == -90 || degrees == 90) &&
1166
((minutes != 0) || (seconds != 0)))
1168
error_Code = SVC_Minutes_or_Seconds_Overflow;
1171
/* Convert DMS to fractional degrees */
1172
*val = (double)( fabs(degrees) + (minutes / 60) + (seconds / 3600) ) * sign;
1174
if (error_Code != SVC_Success)
1179
free(reference_Pointer);
1182
error_Code = SVC_Error;
1188
SVC_Status Latitude_to_String(const double in_latitude, char str[14],
1189
boole use_NSEW, boole use_Minutes, boole use_Seconds)
1191
double degrees = fabs(in_latitude);
1193
char degrees_As_String[14];
1194
long starting_Index = 1;
1195
SVC_Status error_Code = SVC_Success;
1196
long ending_Index = 12;
1198
latitude = in_latitude;
1199
if ((latitude > -0.00000001) && (latitude < 0.00000001))
1203
strcpy(degrees_As_String," ");
1204
Degrees_to_String(degrees, °rees_As_String[1], use_Minutes, use_Seconds, Lat_String);
1205
ending_Index = strlen(°rees_As_String[1]) + 1;
1211
degrees_As_String[ending_Index] = 'S';
1215
degrees_As_String[ending_Index] = 'N';
1222
degrees_As_String[0] = '-';
1226
degrees_As_String[ending_Index+1] = '\0';
1227
strcpy(str, °rees_As_String[starting_Index]);
1232
SVC_Status Zone_to_String(const long zone, char str[3])
1234
SVC_Status error_Code = SVC_Success;
1238
if (sprintf(str, "%1d", zone) <= 0)
1240
error_Code = SVC_Zone_to_String;
1245
if (sprintf(str, "%2d", zone) <= 0)
1247
error_Code = SVC_Zone_to_String;
1255
SVC_Status Ellipsoidal_Height_to_String(const double ellipsoidal_Height, char str[15])
1257
return Long_Meter_to_String(ellipsoidal_Height, str);
1261
SVC_Status Scale_Factor_to_String(const double scale_Factor, char str[8])
1263
SVC_Status error_Code = SVC_Success;
1265
if (sprintf(str, "%.5f", scale_Factor) <= 0)
1267
error_Code = SVC_Scale_Factor_to_String;
1275
( const Input_or_Output Direction,
1276
const Coordinate_Type System,
1281
if (Direction == Input)
1289
sprintf(String,"%s%s%s%s",in_out," Geocentric Coordinates:",Separator,Separator);
1294
sprintf(String,"%s%s%s%s",in_out," Geodetic Coordinates:",Separator,Separator);
1299
sprintf(String,"%s%s%s%s",in_out," GEOREF Coordinates:",Separator,Separator);
1302
case Albers_Equal_Area_Conic:
1304
sprintf(String,"%s%s%s%s",in_out," Albers Equal Area Conic Projection:",Separator,Separator);
1307
case Azimuthal_Equidistant:
1309
sprintf(String,"%s%s%s%s",in_out," Azimuthal Equidistant Projection:",Separator,Separator);
1314
sprintf(String,"%s%s%s%s",in_out," British National Grid Coordinates:",Separator,Separator);
1319
sprintf(String,"%s%s%s%s",in_out," Bonne Projection:",Separator,Separator);
1324
sprintf(String,"%s%s%s%s",in_out," Cassini Projection:",Separator,Separator);
1327
case Cylindrical_Equal_Area:
1329
sprintf(String,"%s%s%s%s",in_out," Cylindrical Equal Area Projection:",Separator,Separator);
1334
sprintf(String,"%s%s%s%s",in_out," Eckert IV Projection:",Separator,Separator);
1339
sprintf(String,"%s%s%s%s",in_out," Eckert VI Projection:",Separator,Separator);
1342
case Equidistant_Cylindrical:
1344
sprintf(String,"%s%s%s%s",in_out," Equidistant Cylindrical Projection:",Separator,Separator);
1349
sprintf(String,"%s%s%s%s",in_out," GARS Coordinates:",Separator,Separator);
1354
sprintf(String,"%s%s%s%s",in_out," Gnomonic Projection:",Separator,Separator);
1357
case Lambert_Conformal_Conic_1:
1359
sprintf(String,"%s%s%s%s",in_out," Lambert Conformal Conic (1 parallel) Projection:",Separator,Separator);
1362
case Lambert_Conformal_Conic_2:
1364
sprintf(String,"%s%s%s%s",in_out," Lambert Conformal Conic (2 parallel) Projection:",Separator,Separator);
1367
case Local_Cartesian:
1369
sprintf(String,"%s%s%s%s",in_out," Local Cartesian Coordinates:",Separator,Separator);
1374
sprintf(String,"%s%s%s%s",in_out," Mercator Projection:",Separator,Separator);
1379
sprintf(String,"%s%s%s%s",in_out," MGRS Coordinates:",Separator,Separator);
1382
case Miller_Cylindrical:
1384
sprintf(String,"%s%s%s%s",in_out," Miller Cylindrical Projection:",Separator,Separator);
1389
sprintf(String,"%s%s%s%s",in_out," Mollweide Projection:",Separator,Separator);
1394
sprintf(String,"%s%s%s%s",in_out," Ney's Projection:",Separator,Separator);
1399
sprintf(String,"%s%s%s%s",in_out," New Zealand Map Grid Projection:",Separator,Separator);
1402
case Oblique_Mercator:
1404
sprintf(String,"%s%s%s%s",in_out," Oblique Mercator Projection:",Separator,Separator);
1409
sprintf(String,"%s%s%s%s",in_out," Orthographic Projection:",Separator,Separator);
1414
sprintf(String,"%s%s%s%s",in_out," Polar Stereographic Projection:",Separator,Separator);
1419
sprintf(String,"%s%s%s%s",in_out," Polyconic Projection:",Separator,Separator);
1424
sprintf(String,"%s%s%s%s",in_out," Sinusoidal Projection:",Separator,Separator);
1429
sprintf(String,"%s%s%s%s",in_out," Stereographic Projection:",Separator,Separator);
1432
case Transverse_Cylindrical_Equal_Area:
1434
sprintf(String,"%s%s%s%s",in_out," Transverse Cylindrical Equal Area Projection:",Separator,Separator);
1437
case Transverse_Mercator:
1439
sprintf(String,"%s%s%s%s",in_out," Transverse Mercator Projection:",Separator,Separator);
1444
sprintf(String,"%s%s%s%s",in_out," UPS Coordinates:",Separator,Separator);
1449
sprintf(String,"%s%s%s%s",in_out," USNG Coordinates:",Separator,Separator);
1454
sprintf(String,"%s%s%s%s",in_out," UTM Coordinates:",Separator,Separator);
1457
case Van_der_Grinten:
1459
sprintf(String,"%s%s%s%s",in_out," Van der Grinten Projection:",Separator,Separator);
1465
void Error_Append (char *New_String,
1469
strcat(String,New_String);
1470
strcat(String,Separator);