MISR Toolkit  1.5.1
MtkSomXYToLS.c
Go to the documentation of this file.
1 /*===========================================================================
2 = =
3 = MtkSomXYToLS =
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 "MisrMapQuery.h"
18 #include "MisrError.h"
19 
33  MTKt_MapInfo mapinfo,
34  double som_x,
35  double som_y,
36  float *line,
37  float *sample )
38 {
39  MTKt_status status_code; /* Return status of this function */
40 
41  if (line == NULL || sample == NULL)
43 
44  /* Determine line/sample from ulc som x/y and resolution */
45  *line = (float)((som_x - mapinfo.som.ulc.x) / mapinfo.resolution);
46  *sample = (float)((som_y - mapinfo.som.ulc.y) / mapinfo.resolution);
47 
48  /* Check line/sample bounds */
49  if (*line < -0.5 || *line > mapinfo.nline - 0.5)
51  if (*sample < -0.5 || *sample > mapinfo.nsample - 0.5)
53 
54  return MTK_SUCCESS;
55 ERROR_HANDLE:
56  if (status_code != MTK_NULLPTR)
57  {
58  *line = -1.0;
59  *sample = -1.0;
60  }
61  return status_code;
62 }
MTKt_status MtkSomXYToLS(MTKt_MapInfo mapinfo, double som_x, double som_y, float *line, float *sample)
Convert SOM X, SOM Y to line, sample.
Definition: MtkSomXYToLS.c:32
#define MTK_ERR_CODE_JUMP(code)
Definition: MisrError.h:175
Map Information.
Definition: MisrMapQuery.h:65
MTKt_status
Definition: MisrError.h:11
MTKt_SomRegion som
Definition: MisrMapQuery.h:74
MTKt_SomCoord ulc
Definition: MisrMapQuery.h:56

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