82 const char *extent_units,
94 if (extent_units == NULL)
98 if (ctr_lat_dd > 90.0 || ctr_lat_dd < -90.0)
100 if (lat_extent <= 0.0)
104 if (ctr_lon_dd > 180.0 || ctr_lon_dd < -180.0)
106 if (lon_extent <= 0.0)
114 if (
strncasecmp(extent_units,
"degrees", strlen(extent_units)) == 0 ||
115 strncasecmp(extent_units,
"deg", strlen(extent_units)) == 0 ||
116 strncasecmp(extent_units,
"dd", strlen(extent_units)) == 0) {
119 double meters_per_deg = 40007821.0 / 360.0;
120 rgn.
hextent.
xlat = (lat_extent * meters_per_deg) / 2.0;
121 rgn.
hextent.
ylon = (lon_extent * meters_per_deg) / 2.0;
123 }
else if (
strncasecmp(extent_units,
"meters", strlen(extent_units)) == 0 ||
124 strncasecmp(extent_units,
"m", strlen(extent_units)) == 0) {
129 }
else if (
strncasecmp(extent_units,
"kilometers", strlen(extent_units)) == 0 ||
130 strncasecmp(extent_units,
"km", strlen(extent_units)) == 0) {
135 }
else if ((resolution = strtod(extent_units, &endptr)) != 0) {
137 if (
strncasecmp(endptr,
"meters", strlen(endptr)) == 0 ||
139 strncasecmp(endptr,
" meters", strlen(endptr)) == 0 ||
142 rgn.
hextent.
xlat = (lat_extent * resolution) / 2.0;
143 rgn.
hextent.
ylon = (lon_extent * resolution) / 2.0;
145 }
else if (
strncasecmp(endptr,
"kilometers", strlen(endptr)) == 0 ||
147 strncasecmp(endptr,
" kilometers", strlen(endptr)) == 0 ||
150 rgn.
hextent.
xlat = (lat_extent * resolution * 1000) / 2.0;
151 rgn.
hextent.
ylon = (lon_extent * resolution * 1000) / 2.0;
#define MTK_ERR_CODE_JUMP(code)
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...
int strncasecmp(const char *s1, const char *s2, size_t n)