MISR Toolkit  1.5.1
MtkLatLonToSomXY.c
Go to the documentation of this file.
1 /*===========================================================================
2 = =
3 = MtkLatLonToSomXY =
4 = =
5 =============================================================================
6 
7  Jet Propulsion Laboratory
8  MISR
9  MISR Toolkit
10 
11  Copyright 2005, California Institute of Technology.
12  ALL RIGHTS RESERVED.
13  U.S. Government Sponsorship acknowledged.
14 
15 ============================================================================*/
16 
17 #include "MisrCoordQuery.h"
18 #include "MisrUnitConv.h"
19 #include "MisrError.h"
20 #include "proj.h"
21 #include "gctp_prototypes.h"
22 #include <stddef.h>
23 
24 
25 
39  int path,
40  double lat_dd,
41  double lon_dd,
42  double *som_x,
43  double *som_y )
44 {
45  MTKt_status status_code; /* Return status of this function */
46  MTKt_status status; /* Return status */
47  MTKt_MisrProjParam pp; /* Projection parameters */
48  int iflg; /* GCTP status flag */
49  double lat_r; /* Latitude in radians */
50  double lon_r; /* Longitude in radians */
51  int (*for_trans[MAXPROJ+1])(double, double, double *, double *); /* Array of function ptrs (Not used) */
52 
53  if (som_x == NULL || som_y == NULL)
55 
56  status = MtkPathToProjParam(path, 0, &pp);
57  MTK_ERR_COND_JUMP(status);
58 
60  NULL, NULL, &iflg, for_trans);
61 
62  if (iflg)
64 
65  status = MtkDdToRad(lat_dd, &lat_r);
66  MTK_ERR_COND_JUMP(status);
67 
68  status = MtkDdToRad(lon_dd, &lon_r);
69  MTK_ERR_COND_JUMP(status);
70 
71  iflg = somfor(lon_r, lat_r, som_x, som_y);
72  if (iflg)
74 
75  return MTK_SUCCESS;
76 
77 ERROR_HANDLE:
78  return status_code;
79 }
#define MAXPROJ
Definition: proj.h:84
MISR Projection Parameters.
double projparam[15]
#define MTK_ERR_CODE_JUMP(code)
Definition: MisrError.h:175
MTKt_status MtkPathToProjParam(int path, int resolution_meters, MTKt_MisrProjParam *pp)
Get projection parameters.
MTKt_status MtkDdToRad(double dd, double *rad)
Convert decimal degrees to radians.
Definition: MtkDdToRad.c:38
int for_init(int outsys, int outzone, const double *outparm, int outdatum, char *fn27, char *fn83, int *iflg, int(*for_trans[])(double, double, double *, double *))
MTKt_status MtkLatLonToSomXY(int path, double lat_dd, double lon_dd, double *som_x, double *som_y)
Convert decimal degrees latitude and longitude to SOM X, SOM Y.
#define MTK_ERR_COND_JUMP(code)
Definition: MisrError.h:188
MTKt_status
Definition: MisrError.h:11
int somfor(double lon, double lat, double *y, double *x)

MISR Toolkit - Copyright © 2005 - 2020 Jet Propulsion Laboratory
Generated on Fri Jun 19 2020 22:49:51