Debian Codegraph @

gctp/src/inv_init.c

raw
1 /*******************************************************************************
2 NAME INV_INIT
3
4 PURPOSE: Initializes inverse projection transformation parameters
5
6 PROGRAMMER DATE REASON
7 ---------- ---- ------
8 T. Mittan 3-09-93 Initial Development
9 S. Nelson 11-94 Added Clarke spheroid default to UTM
10 Raj Gejjagaraguppe(ARC) 08-30-96 Landsat Ratio is removed as hard
11 coded value. Now this ratio can be
12 an input from the user through the
13 projection parameter array element
14 number 9.
15 Raj Gejjagaraguppe(ARC) 01-07-97 Added a new projection type called
16 Integerized Sinusoidal Grid to
17 support MODIS level 3 datasets.
18 D. Wynne(ARC) 3-24-97 Added Support for Power Challenge
19 (R10000 Processor Chip Revision: 2.5)
20 Long is 8 bytes,on all other currently
21 supported platforms Long is 4 bytes.
22 Abe Taaheri 06-27-00 Added a new projection type called
23 Behrmann Cylinderical Equal Area to
24 support EASE grid.
25 Abe Taaheri 10-23-00 Updated for ISINUS projection, so
26 that both codes 31 and 99 (i.e.
27 ISINUS and ISINUS1) can be used
28 for this projection.
29 Abe Taaheri 1-15-03 Modified to support both
30 spherical and ellipsoid
31 models of earth for
32 Normal Cylinderical Equal Area
33 projection.
34 Abe Taaheri 8-15-03 Added CEA projection. This is used
35 by generalized EASE grid, when the
36 EASE grid corners are specified in
37 meters (Note that BCEA is similar
38 projection and used when EASE grid
39 corners are set in packed DMS degrees.
40 Abe Taaheri 11-15-03 Modified the call for LA projection
41 to support ellipsoid earth for this
42 projection
43 ALGORITHM REFERENCES
44
45 1. Snyder, John P., "Map Projections--A Working Manual", U.S. Geological
46 Survey Professional Paper 1395 (Supersedes USGS Bulletin 1532), United
47 State Government Printing Office, Washington D.C., 1987.
48
49 2. Snyder, John P. and Voxland, Philip M., "An Album of Map Projections",
50 U.S. Geological Survey Professional Paper 1453 , United State Government
51 Printing Office, Washington D.C., 1989.
52 *******************************************************************************/
53 #include <stdio.h>
54 #include "cproj.h"
55 #include "proj.h"
56
57 int inv_init(
58 int insys, /* input system code */
59 int inzone, /* input zone number */
60 double *inparm, /* input array of projection parameters */
61 int indatum, /* input datum code */
62 char *fn27, /* NAD 1927 parameter file */
63 char *fn83, /* NAD 1983 parameter file */
64 int *iflg, /* status flag */
65 int (*inv_trans[])(double, double, double*, double*))
66 /* inverse function pointer */
67 {
68 long zone; /* zone number */
69 double azimuth; /* azimuth */
70 double angle; /* rotation anlge */
71 double alf; /* SOM angle */
72 double lon1; /* longitude point in utm scene */
73 double lon2; /* 2nd longitude point */
74 double lat1; /* 1st standard parallel */
75 double lat2; /* 2nd standard parallel */
76 double center_long; /* center longitude */
77 double center_lat; /* center latitude */
78 double h; /* height above sphere */
79 double lat_origin; /* latitude at origin */
80 double lon_origin; /* longitude at origin */
81 double r_major; /* major axis in meters */
82 double r_minor; /* minor axis in meters */
83 double scale_factor; /* scale factor */
84 double false_easting; /* false easting in meters */
85 double false_northing; /* false northing in meters */
86 double radius; /* radius of sphere */
87 double shape_m; /* constant used for Oblated Equal Area */
88 double shape_n; /* constant used for Oblated Equal Area */
89 /*long start; */ /* start of SOM Beginning or end */
90 double time; /* SOM time */
91 long path; /* SOM path number */
92 long satnum; /* SOM satellite number */
93 long mode; /* which format is used A or B */
94 long tmpdatum; /* temporary datum for UTM */
95 double sat_ratio; /* satellite ratio which specify the start point*/
96 double dzone; /* number of longitudinal zones in ISG */
97 double djustify; /* justify flag in ISG projection */
98
99 long thing; /* used to initialize 8 byte pointer, added */
100 /* for Power Challenge */
101 long *iflg64; /* 8 byte status flag for Power Challenge */
102
103 thing = 0; /* These lines are to initialize the */
104 iflg64 = &thing; /* the 8-byte pointer address */
105
106 /* Initialize inverse transformations
107 -----------------------------------*/
108 /* find the correct major and minor axis
109 --------------------------------------*/
110 if(insys == CEA)
111 {
112 if(inparm[0] > 0.0 || inparm[0] < 0.0 ||
113 inparm[1] > 0.0 || inparm[1] < 0.0)
114 {
115 indatum = -20;
116 }
117
118 sphdz(indatum,inparm,&r_major,&r_minor,&radius);
119 }
120 else if(insys == BCEA)
121 {
122 if(inparm[0] > 0.0 || inparm[0] < 0.0 ||
123 inparm[1] > 0.0 || inparm[1] < 0.0)
124 {
125 indatum = -20;
126 }
127 else /* for BCEA use 6371228.0 m as default for r_maj and r_min, i.e.
128 use spherical earth model with radius 6371228.0 m instead of
129 Clarke 1866 spheroid */
130 {
131 indatum = 20;
132 }
133
134 sphdz(indatum,inparm,&r_major,&r_minor,&radius);
135 }
136 else
137 {
138 sphdz(indatum,inparm,&r_major,&r_minor,&radius);
139 }
140 false_easting = inparm[6];
141 false_northing = inparm[7];
142
143 if (insys == CEA)/* Cylindrical Equal-Area, used for EASE grid wghen
144 grid corners are specified in meters */
145 {
146 /* this is the call to initialize CEA
147 ----------------------------------------*/
148 center_long = paksz(inparm[4],iflg64)* 3600 * S2R;
149 *iflg = (int)*iflg64;
150 if ((int)*iflg64 != 0)
151 return ERROR;
152
153 lat1 = paksz(inparm[5],iflg64)* 3600 * S2R;
154 *iflg = (int)*iflg64;
155 if ((int)*iflg64 != 0)
156 return ERROR;
157
158 *iflg64 = ceainvint(r_major,r_minor,center_long,lat1,false_easting,
159 false_northing);
160 *iflg = (int)*iflg64;
161 inv_trans[insys] = ceainv;
162 }
163 else
164 if (insys == BCEA)/* Cylindrical Equal-Area, used for EASE grid wghen
165 grid corners are specified in DMS degrees */
166 {
167 /* this is the call to initialize BCEA
168 ----------------------------------------*/
169 center_long = paksz(inparm[4],iflg64)* 3600 * S2R;
170 *iflg = (int)*iflg64;
171 if ((int)*iflg64 != 0)
172 return ERROR;
173
174 lat1 = paksz(inparm[5],iflg64)* 3600 * S2R;
175 *iflg = (int)*iflg64;
176 if ((int)*iflg64 != 0)
177 return ERROR;
178
179 *iflg64 = bceainvint(r_major,r_minor,center_long,lat1,false_easting,
180 false_northing);
181 *iflg = (int)*iflg64;
182 inv_trans[insys] = bceainv;
183 }
184 else
185 if (insys == UTM)
186 {
187 /* this is the call to initialize U T M
188 -------------------------------------*/
189 /* set Clarke 1866 spheroid if negative datum code
190 ----------------------------------------------*/
191 if (indatum < 0)
192 {
193 tmpdatum = 0;
194 sphdz(tmpdatum,inparm,&r_major,&r_minor,&radius);
195 }
196 zone = inzone;
197 if (zone == 0)
198 {
199 lon1 = paksz(inparm[0],iflg64) * 3600 * S2R;
200 *iflg = (int)*iflg64;
201 if ((int)*iflg64 != 0)
202 return ERROR;
203 lat1 = paksz(inparm[1],iflg64) * 3600 * S2R;
204 *iflg = (int)*iflg64;
205 if ((int)*iflg64 != 0)
206 return ERROR;
207 zone = calc_utm_zone(lon1 * R2D);
208 if (lat1 < 0)
209 zone = -zone;
210 }
211 scale_factor = .9996;
212 *iflg64 = utminvint(r_major,r_minor,scale_factor,zone);
213 *iflg = (int)*iflg64;
214 inv_trans[insys] = utminv;
215 }
216 else
217 if (insys == SPCS)
218 {
219 /* this is the call to initialize STATE PLANE
220 --------------------------------------------*/
221 *iflg64 = stplninvint( inzone,indatum,fn27,fn83);
222 *iflg = (int)*iflg64;
223 if ((int)*iflg64 != 0)
224 return ERROR;
225 inv_trans[insys] = stplninv;
226 }
227 else
228 if (insys == ALBERS)
229 {
230 /* this is the call to initialize ALBERS
231 ---------------------------------------*/
232 lat1 = paksz(inparm[2],iflg64) * 3600 * S2R;
233 *iflg = (int)*iflg64;
234 if ((int)*iflg64 != 0)
235 return ERROR;
236 lat2 = paksz(inparm[3],iflg64) * 3600 * S2R;
237 *iflg = (int)*iflg64;
238 if ((int)*iflg64 != 0)
239 return ERROR;
240 center_long = paksz(inparm[4],iflg64) * 3600 * S2R;
241 *iflg = (int)*iflg64;
242 if ((int)*iflg64 != 0)
243 return ERROR;
244 lat_origin = paksz(inparm[5],iflg64) * 3600 * S2R;
245 *iflg = (int)*iflg64;
246 if ((int)*iflg64 != 0)
247 return ERROR;
248 *iflg64 = alberinvint(r_major,r_minor,lat1,lat2,center_long,lat_origin,
249 false_easting, false_northing);
250 *iflg = (int)*iflg64;
251 inv_trans[insys] = alberinv;
252 }
253 else
254 if (insys == LAMCC)
255 {
256 /* this is the call to initialize LAMBERT CONFORMAL CONIC
257 --------------------------------------------------------*/
258 lat1 = paksz(inparm[2],iflg64) * 3600 * S2R;
259 *iflg = (int)*iflg64;
260 if ((int)*iflg64 != 0)
261 return ERROR;
262 lat2 = paksz(inparm[3],iflg64) * 3600 * S2R;
263 *iflg = (int)*iflg64;
264 if ((int)*iflg64 != 0)
265 return ERROR;
266 center_long = paksz(inparm[4],iflg64) * 3600 * S2R;
267 *iflg = (int)*iflg64;
268 if ((int)*iflg64 != 0)
269 return ERROR;
270 lat_origin = paksz(inparm[5],iflg64) * 3600 * S2R;
271 *iflg = (int)*iflg64;
272 if ((int)*iflg64 != 0)
273 return ERROR;
274 *iflg64 = lamccinvint(r_major,r_minor,lat1,lat2,center_long,lat_origin,
275 false_easting, false_northing);
276 *iflg = (int)*iflg64;
277 inv_trans[insys] = lamccinv;
278 }
279 else
280 if (insys == MERCAT)
281 {
282 /* this is the call to initialize MERCATOR
283 ----------------------------------------*/
284 center_long = paksz(inparm[4],iflg64) * 3600 * S2R;
285 *iflg = (int)*iflg64;
286 if ((int)*iflg64 != 0)
287 return ERROR;
288 lat1 = paksz(inparm[5],iflg64) * 3600 * S2R;
289 *iflg = (int)*iflg64;
290 if ((int)*iflg64 != 0)
291 return ERROR;
292 *iflg64 = merinvint(r_major,r_minor,center_long,lat1,false_easting,
293 false_northing);
294 *iflg = (int)*iflg64;
295 inv_trans[insys] = merinv;
296 }
297 else
298 if (insys == PS)
299 {
300 /* this is the call to initialize POLAR STEREOGRAPHIC
301 ----------------------------------------------------*/
302 center_long = paksz(inparm[4],iflg64) * 3600 * S2R;
303 *iflg = (int)*iflg64;
304 if ((int)*iflg64 != 0)
305 return ERROR;
306 lat1 = paksz(inparm[5],iflg64) * 3600 * S2R;
307 *iflg = (int)*iflg64;
308 if ((int)*iflg64 != 0)
309 return ERROR;
310 *iflg64 = psinvint(r_major,r_minor,center_long,lat1,false_easting,
311 false_northing);
312 *iflg = (int)*iflg64;
313 inv_trans[insys] = psinv;
314 }
315 else
316 if (insys == POLYC)
317 {
318 /* this is the call to initialize POLYCONIC
319 -----------------------------------------*/
320 center_long = paksz(inparm[4],iflg64) * 3600 * S2R;
321 *iflg = (int)*iflg64;
322 if ((int)*iflg64 != 0)
323 return ERROR;
324 lat_origin = paksz(inparm[5],iflg64) * 3600 * S2R;
325 *iflg = (int)*iflg64;
326 if ((int)*iflg64 != 0)
327 return ERROR;
328 *iflg64 = polyinvint(r_major,r_minor,center_long,lat_origin,false_easting,
329 false_northing);
330 *iflg = (int)*iflg64;
331 inv_trans[insys] = polyinv;
332 }
333 else
334 if (insys == EQUIDC)
335 {
336 /* this is the call to initialize EQUIDISTANT CONIC
337 ---------------------------------------------------*/
338 lat1 = paksz(inparm[2],iflg64) * 3600 * S2R;
339 *iflg = (int)*iflg64;
340 if ((int)*iflg64 != 0)
341 return ERROR;
342 lat2 = paksz(inparm[3],iflg64) * 3600 * S2R;
343 *iflg = (int)*iflg64;
344 if ((int)*iflg64 != 0)
345 return ERROR;
346 center_long = paksz(inparm[4],iflg64) * 3600 * S2R;
347 *iflg = (int)*iflg64;
348 if ((int)*iflg64 != 0)
349 return ERROR;
350 lat_origin = paksz(inparm[5],iflg64) * 3600 * S2R;
351 *iflg = (int)*iflg64;
352 if ((int)*iflg64 != 0)
353 return ERROR;
354 if (inparm[8] == 0)
355 mode = 0;
356 else
357 mode = 1;
358 *iflg64 = eqconinvint(r_major,r_minor,lat1,lat2,center_long,lat_origin,
359 false_easting,false_northing,mode);
360 *iflg = (int)*iflg64;
361 inv_trans[insys] = eqconinv;
362 }
363 else
364 if (insys == TM)
365 {
366 /* this is the call to initialize TRANSVERSE MERCATOR
367 -------------------------------------------------*/
368 scale_factor = inparm[2];
369 center_long = paksz(inparm[4],iflg64) * 3600 * S2R;
370 *iflg = (int)*iflg64;
371 if ((int)*iflg64 != 0)
372 return ERROR;
373 lat_origin = paksz(inparm[5],iflg64) * 3600 * S2R;
374 *iflg = (int)*iflg64;
375 if ((int)*iflg64 != 0)
376 return ERROR;
377 *iflg64 = tminvint(r_major,r_minor,scale_factor,center_long,lat_origin,
378 false_easting, false_northing);
379 *iflg = (int)*iflg64;
380 inv_trans[insys] = tminv;
381 }
382 else
383 if (insys == STEREO)
384 {
385 /* this is the call to initialize STEREOGRAPHIC
386 ---------------------------------------------*/
387 center_long = paksz(inparm[4],iflg64) * 3600 * S2R;
388 *iflg = (int)*iflg64;
389 if ((int)*iflg64 != 0)
390 return ERROR;
391 center_lat = paksz(inparm[5],iflg64) * 3600 * S2R;
392 *iflg = (int)*iflg64;
393 if ((int)*iflg64 != 0)
394 return ERROR;
395 *iflg64 = sterinvint(radius,center_long,center_lat,false_easting,
396 false_northing);
397 *iflg = (int)*iflg64;
398 inv_trans[insys] = sterinv;
399 }
400 else
401 if (insys == LAMAZ)
402 {
403 /* this is the call to initialize LAMBERT AZIMUTHAL EQUAL-AREA
404 -------------------------------------------------------------*/
405 center_long = paksz(inparm[4],iflg64) * 3600 * S2R;
406 *iflg = (int)*iflg64;
407 if ((int)*iflg64 != 0)
408 return ERROR;
409 center_lat = paksz(inparm[5],iflg64) * 3600 * S2R;
410 *iflg = (int)*iflg64;
411 if ((int)*iflg64 != 0)
412 return ERROR;
413 *iflg64 = lamazinvint(r_major, r_minor, center_long, center_lat,false_easting,
414 false_northing);
415 *iflg = (int)*iflg64;
416 inv_trans[insys] = lamazinv;
417 }
418 else
419 if (insys == AZMEQD)
420 {
421 /* this is the call to initialize AZIMUTHAL EQUIDISTANT
422 ------------------------------------------------------*/
423 center_long = paksz(inparm[4],iflg64) * 3600 * S2R;
424 *iflg = (int)*iflg64;
425 if ((int)*iflg64 != 0)
426 return ERROR;
427 center_lat = paksz(inparm[5],iflg64) * 3600 * S2R;
428 *iflg = (int)*iflg64;
429 if ((int)*iflg64 != 0)
430 return ERROR;
431 *iflg64 = aziminvint(radius,center_long,center_lat,false_easting,
432 false_northing);
433 *iflg = (int)*iflg64;
434 inv_trans[insys] = aziminv;
435 }
436 else
437 if (insys == GNOMON)
438 {
439 /* this is the call to initialize GNOMONIC
440 ----------------------------------------*/
441 center_long = paksz(inparm[4],iflg64) * 3600 * S2R;
442 *iflg = (int)*iflg64;
443 if ((int)*iflg64 != 0)
444 return ERROR;
445 center_lat = paksz(inparm[5],iflg64) * 3600 * S2R;
446 *iflg = (int)*iflg64;
447 if ((int)*iflg64 != 0)
448 return ERROR;
449 *iflg64 = gnominvint(radius,center_long,center_lat,false_easting,
450 false_northing);
451 *iflg = (int)*iflg64;
452 inv_trans[insys] = gnominv;
453 }
454 else
455 if (insys == ORTHO)
456 {
457 /* this is the call to initialize ORTHOGRAPHIC
458 --------------------------------------------*/
459 center_long = paksz(inparm[4],iflg64) * 3600 * S2R;
460 *iflg = (int)*iflg64;
461 if ((int)*iflg64 != 0)
462 return ERROR;
463 center_lat = paksz(inparm[5],iflg64) * 3600 * S2R;
464 *iflg = (int)*iflg64;
465 if ((int)*iflg64 != 0)
466 return ERROR;
467 *iflg64 = orthinvint(radius,center_long,center_lat,false_easting,
468 false_northing);
469 *iflg = (int)*iflg64;
470 inv_trans[insys] = orthinv;
471 }
472 else
473 if (insys == GVNSP)
474 {
475 /* this is the call to initialize GENERAL VERTICAL NEAR SIDED PERSPECTIVE
476 -----------------------------------------------------------------------*/
477 center_long = paksz(inparm[4],iflg64) * 3600 * S2R;
478 *iflg = (int)*iflg64;
479 if ((int)*iflg64 != 0)
480 return ERROR;
481 center_lat = paksz(inparm[5],iflg64) * 3600 * S2R;
482 *iflg = (int)*iflg64;
483 if ((int)*iflg64 != 0)
484 return ERROR;
485 h = inparm[2];
486 *iflg64 = gvnspinvint(radius,h,center_long,center_lat,false_easting,
487 false_northing);
488 *iflg = (int)*iflg64;
489 inv_trans[insys] = gvnspinv;
490 }
491 else
492 if (insys == SNSOID)
493 {
494 /* this is the call to initialize SINUSOIDAL
495 --------------------------------------------*/
496 center_long = paksz(inparm[4],iflg64) * 3600 * S2R;
497 *iflg = (int)*iflg64;
498 if ((int)*iflg64 != 0)
499 return ERROR;
500 *iflg64 = sininvint(r_major,r_minor, center_long,false_easting,false_northing);
501 *iflg = (int)*iflg64;
502 inv_trans[insys] = sininv;
503 }
504 else
505 if (insys == EQRECT)
506 {
507 /* this is the call to initialize EQUIRECTANGULAR
508 -----------------------------------------------*/
509 center_long = paksz(inparm[4],iflg64) * 3600 * S2R;
510 *iflg = (int)*iflg64;
511 if ((int)*iflg64 != 0)
512 return ERROR;
513 lat1 = paksz(inparm[5],iflg64) * 3600 * S2R;
514 *iflg = (int)*iflg64;
515 if ((int)*iflg64 != 0)
516 return ERROR;
517 *iflg64 = equiinvint(radius,center_long,lat1,false_easting,
518 false_northing);
519 *iflg = (int)*iflg64;
520 inv_trans[insys] = equiinv;
521 }
522 else
523 if (insys == MILLER)
524 {
525 /* this is the call to initialize MILLER CYLINDRICAL
526 --------------------------------------------------*/
527 center_long = paksz(inparm[4],iflg64) * 3600 * S2R;
528 *iflg = (int)*iflg64;
529 if ((int)*iflg64 != 0)
530 return ERROR;
531 *iflg64 = millinvint(radius, center_long,false_easting,false_northing);
532 *iflg = (int)*iflg64;
533 inv_trans[insys] = millinv;
534 }
535 else
536 if (insys == VGRINT)
537 {
538 /* this is the call to initialize VAN DER GRINTEN
539 -----------------------------------------------*/
540 center_long = paksz(inparm[4],iflg64) * 3600 * S2R;
541 *iflg = (int)*iflg64;
542 if ((int)*iflg64 != 0)
543 return ERROR;
544 *iflg64 = vandginvint(radius, center_long,false_easting,false_northing);
545 *iflg = (int)*iflg64;
546 inv_trans[insys] = vandginv;
547 }
548 else
549 if (insys == HOM)
550 {
551 /* this is the call to initialize HOTLINE OBLIQUE MERCATOR
552 ---------------------------------------------------------*/
553 scale_factor = inparm[2];
554 lat_origin = paksz(inparm[5],iflg64) * 3600 * S2R;
555 *iflg = (int)*iflg64;
556 if ((int)*iflg64 != 0)
557 return ERROR;
558 if (inparm[12] != 0)
559 {
560 mode = 1;
561 azimuth = paksz(inparm[3],iflg64) * 3600 * S2R;
562 *iflg = (int)*iflg64;
563 if ((int)*iflg64 != 0)
564 return ERROR;
565 lon_origin = paksz(inparm[4],iflg64) * 3600 * S2R;
566 *iflg = (int)*iflg64;
567 if ((int)*iflg64 != 0)
568 return ERROR;
569 }
570 else
571 {
572 mode = 0;
573 lon1 = paksz(inparm[8],iflg64) * 3600 * S2R;
574 *iflg = (int)*iflg64;
575 if ((int)*iflg64 != 0)
576 return ERROR;
577 lat1 = paksz(inparm[9],iflg64) * 3600 * S2R;
578 *iflg = (int)*iflg64;
579 if ((int)*iflg64 != 0)
580 return ERROR;
581 lon2 = paksz(inparm[10],iflg64) * 3600 * S2R;
582 *iflg = (int)*iflg64;
583 if ((int)*iflg64 != 0)
584 return ERROR;
585 lat2 = paksz(inparm[11],iflg64) * 3600 * S2R;
586 *iflg = (int)*iflg64;
587 if ((int)*iflg64 != 0)
588 return ERROR;
589
590 }
591 *iflg64 = omerinvint(r_major,r_minor,scale_factor,azimuth,lon_origin,
592 lat_origin,false_easting, false_northing,lon1,lat1,
593 lon2,lat2,mode);
594 *iflg = (int)*iflg64;
595 inv_trans[insys] = omerinv;
596 }
597 else
598 if (insys == SOM)
599 {
600
601 /* this is the call to initialize SOM
602 -----------------------------------*/
603 path = (long) inparm[3];
604 satnum = (long) inparm[2];
605 if (inparm[12] == 0)
606 {
607 mode = 1;
608
609 alf = paksz(inparm[3],iflg64) * 3600.0 * S2R;
610 *iflg = (int)*iflg64;
611
612 if ((int)*iflg64 != 0)
613 return ERROR;
614
615 lon1 = paksz(inparm[4],iflg64) * 3600 * S2R;
616 *iflg = (int)*iflg64;
617
618 if ((int)*iflg64 != 0)
619 return ERROR;
620
621 time = inparm[8];
622 sat_ratio = inparm[9];
623
624 /* start = (long) inparm[10];*/
625 }
626 else
627 mode = 0;
628 /*
629 *iflg64 = sominvint(r_major,r_minor,satnum,path,false_easting,
630 false_northing);
631 *iflg = (int)*iflg64;
632 */
633
634 *iflg64 = sominvint(r_major,r_minor,satnum,path,alf,lon1,false_easting,
635 false_northing,time,mode,sat_ratio);
636 *iflg = (int)*iflg64;
637 inv_trans[insys] = sominv;
638 }
639 else
640 if (insys == HAMMER)
641 {
642 /* this is the call to initialize HAMMER
643 --------------------------------------*/
644 center_long = paksz(inparm[4],iflg64) * 3600 * S2R;
645 *iflg = (int)*iflg64;
646 if ((int)*iflg64 != 0)
647 return ERROR;
648 *iflg64 = haminvint(radius, center_long,false_easting,false_northing);
649 *iflg = (int)*iflg64;
650 inv_trans[insys] = haminv;
651 }
652 else
653 if (insys == ROBIN)
654 {
655 /* this is the call to initialize ROBINSON
656 ----------------------------------------*/
657 center_long = paksz(inparm[4],iflg64) * 3600 * S2R;
658 *iflg = (int)*iflg64;
659 if ((int)*iflg64 != 0)
660 return ERROR;
661 *iflg64 = robinvint(radius, center_long,false_easting,false_northing);
662 *iflg = (int)*iflg64;
663 inv_trans[insys] = robinv;
664 }
665 else
666 if (insys == GOODE)
667 {
668 /* this is the call to initialize GOODE'S HOMOLOSINE
669 ---------------------------------------------------*/
670 *iflg64 = goodinvint(radius);
671 *iflg = (int)*iflg64;
672 inv_trans[insys] = goodinv;
673 }
674 else
675 if (insys == MOLL)
676 {
677 /* this is the call to initialize MOLLWEIDE
678 -------------------------------------------*/
679 center_long = paksz(inparm[4],iflg64) * 3600 * S2R;
680 *iflg = (int)*iflg64;
681 if ((int)*iflg64 != 0)
682 return ERROR;
683 *iflg64 = molwinvint(radius, center_long,false_easting,false_northing);
684 *iflg = (int)*iflg64;
685 inv_trans[insys] = molwinv;
686 }
687 else
688 if (insys == IMOLL)
689 {
690 /* this is the call to initialize INTERRUPTED MOLLWEIDE
691 -----------------------------------------------------*/
692 *iflg64 = imolwinvint(radius);
693 *iflg = (int)*iflg64;
694 inv_trans[insys] = imolwinv;
695 }
696 else
697 if (insys == ALASKA)
698 {
699 /* this is the call to initialize ALASKA CONFORMAL
700 ------------------------------------------------*/
701 *iflg64 = alconinvint(r_major,r_minor,false_easting,false_northing);
702 *iflg = (int)*iflg64;
703 inv_trans[insys] = alconinv;
704 }
705 else
706 if (insys == WAGIV)
707 {
708 /* this is the call to initialize WAGNER IV
709 -----------------------------------------*/
710 center_long = paksz(inparm[4],iflg64) * 3600 * S2R;
711 *iflg = (int)*iflg64;
712 if ((int)*iflg64 != 0)
713 return ERROR;
714 *iflg64 = wivinvint(radius, center_long,false_easting,false_northing);
715 *iflg = (int)*iflg64;
716 inv_trans[insys] = wivinv;
717 }
718 else
719 if (insys == WAGVII)
720 {
721 /* this is the call to initialize WAGNER VII
722 ------------------------------------------*/
723 center_long = paksz(inparm[4],iflg64) * 3600 * S2R;
724 *iflg = (int)*iflg64;
725 if ((int)*iflg64 != 0)
726 return ERROR;
727 *iflg64 = wviiinvint(radius, center_long,false_easting,false_northing);
728 *iflg = (int)*iflg64;
729 inv_trans[insys] = wviiinv;
730 }
731 else
732 if (insys == OBEQA)
733 {
734 /* this is the call to initialize OBLATED EQUAL AREA
735 ---------------------------------------------------*/
736 center_long = paksz(inparm[4],iflg64) * 3600 * S2R;
737 *iflg = (int)*iflg64;
738 if ((int)*iflg64 != 0)
739 return ERROR;
740 center_lat = paksz(inparm[5],iflg64) * 3600 * S2R;
741 *iflg = (int)*iflg64;
742 if ((int)*iflg64 != 0)
743 return ERROR;
744 shape_m = inparm[2];
745 shape_n = inparm[3];
746 angle = paksz(inparm[8],iflg64) * 3600 * S2R;
747 *iflg = (int)*iflg64;
748 if ((int)*iflg64 != 0)
749 return ERROR;
750 *iflg64 = obleqinvint(radius,center_long,center_lat,shape_m, shape_n,
751 angle,false_easting,false_northing);
752 *iflg = (int)*iflg64;
753 inv_trans[insys] = obleqinv;
754 }
755 else
756 if ((insys == ISINUS) || (insys == ISINUS1))
757 {
758 /* this is the call to initialize INTEGERIZED SINUSOIDAL GRID
759 ------------------------------------------------------------*/
760
761 center_long = paksz(inparm[4],iflg64)* 3600 * S2R;
762 *iflg = (int)*iflg64;
763 if ((int)*iflg64 != 0)
764 return ERROR;
765 dzone = inparm[8];
766 djustify = inparm[10];
767
768 *iflg64 = isinusinvinit(radius, center_long, false_easting, false_northing,
769 dzone, djustify);
770 *iflg = (int)*iflg64;
771
772 inv_trans[insys] = isinusinv;
773 }
774
775 return OK;
776 }