52 double min_som_x = 0.0;
53 double min_som_y = 0.0;
54 double max_som_x = 0.0;
55 double max_som_y = 0.0;
57 double rad2deg = 180 / acos(-1);
63 if (Map_info == NULL) {
72 if (Proj_info == NULL) {
103 &corner_lon[0], &corner_lat[0]);
105 &corner_lon[1], &corner_lat[1]);
107 &corner_lon[2], &corner_lat[2]);
109 &corner_lon[3], &corner_lat[3]);
117 for (i = 0 ; i < 4 ; i++) {
123 corner_lat[i]*rad2deg,
124 corner_lon[i]*rad2deg,
128 if (i == 0 || som_x < min_som_x) {
131 if (i == 0 || som_y < min_som_y) {
134 if (i == 0 || som_x > max_som_x) {
137 if (i == 0 || som_y > max_som_y) {
147 double som_x_extent = max_som_x - min_som_x;
148 double som_y_extent = max_som_y - min_som_y;
150 double center_som_x = min_som_x + (max_som_x - min_som_x) / 2.0;
151 double center_som_y = min_som_y + (max_som_y - min_som_y) / 2.0;
160 som_x_extent, som_y_extent,
"meters",
170 *Region = region_tmp;
MTKt_status MtkSetRegionByGenericMapInfo(const MTKt_GenericMapInfo *Map_info, const MTKt_GCTPProjInfo *Proj_info, int Path, MTKt_Region *Region)
Create an MtkRegion structure that contains the given map.
GCTP projection information.
MTKt_status MtkSomXYToLatLon(int path, double som_x, double som_y, double *lat_dd, double *lon_dd)
Convert SOM X, SOM Y to decimal degrees latitude and longitude.
#define MTK_ERR_CODE_MSG_JUMP(code, msg)
#define MTK_ERR_MSG_JUMP(msg)
MTKt_status MtkSetRegionByLatLonExtent(double ctr_lat_dd, double ctr_lon_dd, double lat_extent, double lon_extent, const char *extent_units, MTKt_Region *region)
Select region by latitude, longitude in decimal degrees, and extent in specified units of degrees...
#define MTK_ERR_COND_JUMP(code)
int inv_init(int insys, int inzone, const double *inparm, int indatum, char *fn27, char *fn83, int *iflg, int(*inv_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.