26#define MULTIPLY_LOOP(x, y, c, m) \
28 for (i = 0; i < c; ++i) { \
34#define DIVIDE_LOOP(x, y, c, m) \
36 for (i = 0; i < c; ++i) { \
42static double METERS_in = 1.0, METERS_out = 1.0;
45 double *ymin,
double *ymax)
126 for (i = 0; i < 20; i++) {
131 y[i + 20] = window.
south;
133 x[i + 40] = window.
west;
136 x[i + 60] = window.
east;
140 y[80] = window.
north;
142 y[81] = window.
south;
144 y[82] = window.
north;
146 y[83] = window.
south;
147 x[84] = (window.
west + window.
east) / 2.;
155 *xmin = *xmax =
x[84];
156 *ymin = *ymax = y[84];
157 for (i = 0; i < 84; i++) {
176 else if (*xmax > 180 && *xmin > -180 && *xmax - 360 < *xmin) {
183 G_debug(1,
"input window east: %.8f", window.
east);
184 G_debug(1,
"input window west: %.8f", window.
west);
186 G_debug(1,
"transformed xmin: %.8f", *xmin);
187 G_debug(1,
"transformed xmax: %.8f", *xmax);
188 G_debug(1,
"transformed ymin: %.8f", *ymin);
189 G_debug(1,
"transformed ymax: %.8f", *ymax);
195 if (
fabs(*xmin) > 180) {
196 G_warning(
_(
"Invalid west longitude %g"), *xmin);
199 if (
fabs(*xmax) > 180) {
200 G_warning(
_(
"Invalid east longitude %g"), *xmax);
203 if (
fabs(*ymin) > 90) {
204 G_warning(
_(
"Invalid south latitude %g"), *ymin);
207 if (
fabs(*ymax) > 90) {
208 G_warning(
_(
"Invalid north latitude %g"), *ymax);
212 G_warning(
_(
"South %g is larger than north %g"), *ymin, *ymax);
216 G_debug(1,
"get_pj_area(): xmin %g, xmax %g, ymin %g, ymax %g", *xmin,
217 *xmax, *ymin, *ymax);
452 "A custom pipeline requires input and output projection info"));
480 _(
"The transformation pipeline contains an '%s' step. "
481 "Remove this step if easting and northing are swapped in "
533 double xmin, xmax, ymin, ymax;
545 G_warning(
_(
"Unable to determine area of interest for '%s'"),
625 G_warning(
_(
"proj_normalize_for_visualization() failed for "
677 "with the %s option"),
780 G_debug(1,
"proj_create_crs_to_crs() succeeded with PROJ%d",
799 _(
"proj_normalize_for_visualization() failed for '%s'"),
812 G_warning(
_(
"No PROJ definition for normalized version "
875 double *y,
double *z)
958 c.xyzt.x = *
x * METERS_in;
959 c.xyzt.y = *y * METERS_in;
966 G_debug(1,
"c.xyzt.x: %g", c.xyzt.x);
967 G_debug(1,
"c.xyzt.y: %g", c.xyzt.y);
968 G_debug(1,
"c.xyzt.z: %g", c.xyzt.z);
996 *
x = c.xyzt.x / METERS_out;
997 *y = c.xyzt.y / METERS_out;
1034 double *y,
double *z,
int n)
1102 for (i = 0; i < n; i++)
1117 for (i = 0; i < n; i++) {
1143 for (i = 0; i < n; i++) {
1159 x[i] = c.xy.x / METERS_out;
1160 y[i] = c.xy.y / METERS_out;
1167 for (i = 0; i < n; i++) {
1169 c.xyzt.x =
x[i] * METERS_in;
1170 c.xyzt.y = y[i] * METERS_in;
1187 for (i = 0; i < n; i++) {
1189 c.xyzt.x =
x[i] * METERS_in;
1190 c.xyzt.y = y[i] * METERS_in;
1196 x[i] = c.xy.x / METERS_out;
1197 y[i] = c.xy.y / METERS_out;
1263 *
x = c.xy.x / METERS_out;
1264 *y = c.xy.y / METERS_out;
1269 c.xyzt.x = *
x * METERS_in;
1270 c.xyzt.y = *y * METERS_in;
1283 *
x = c.xy.x / METERS_out;
1284 *y = c.xy.y / METERS_out;
1339 for (i = 0; i <
count; ++i)
1347 for (i = 0; i <
count; i++) {
1361 for (i = 0; i <
count; i++) {
1370 x[i] = c.xy.x / METERS_out;
1371 y[i] = c.xy.y / METERS_out;
1378 for (i = 0; i <
count; i++) {
1380 c.xyzt.x =
x[i] * METERS_in;
1381 c.xyzt.y = y[i] * METERS_in;
1392 for (i = 0; i <
count; i++) {
1394 c.xyzt.x =
x[i] * METERS_in;
1395 c.xyzt.y = y[i] * METERS_in;
1401 x[i] = c.xy.x / METERS_out;
1402 y[i] = c.xy.y / METERS_out;
void G_free(void *)
Free allocated memory.
void void void void G_fatal_error(const char *,...) __attribute__((format(printf
void G_warning(const char *,...) __attribute__((format(printf
void G_get_set_window(struct Cell_head *)
Get the current working window (region)
char * G_store_upper(const char *)
Copy string to allocated memory and convert copied string to upper case.
void void void G_important_message(const char *,...) __attribute__((format(printf
int G_asprintf(char **, const char *,...) __attribute__((format(printf
char * G_store(const char *)
Copy string to allocated memory.
int G_debug(int, const char *,...) __attribute__((format(printf
int GPJ_transform(const struct pj_info *info_in, const struct pj_info *info_out, const struct pj_info *info_trans, int dir, double *x, double *y, double *z)
Re-project a point between two co-ordinate systems using a transformation object prepared with GPJ_pr...
char * get_pj_type_string(PJ *pj)
int pj_do_proj(double *x, double *y, const struct pj_info *info_in, const struct pj_info *info_out)
Re-project a point between two co-ordinate systems.
int pj_do_transform(int count, double *x, double *y, double *h, const struct pj_info *info_in, const struct pj_info *info_out)
Re-project an array of points between two co-ordinate systems with optional ellipsoidal height conver...
int get_pj_area(const struct pj_info *iproj, double *xmin, double *xmax, double *ymin, double *ymax)
int GPJ_transform_array(const struct pj_info *info_in, const struct pj_info *info_out, const struct pj_info *info_trans, int dir, double *x, double *y, double *z, int n)
Re-project an array of points between two co-ordinate systems using a transformation object prepared ...
PJ * get_pj_object(const struct pj_info *in_gpj, char **in_defstr)
int GPJ_init_transform(const struct pj_info *info_in, const struct pj_info *info_out, struct pj_info *info_trans)
Create a PROJ transformation object to transform coordinates from an input SRS to an output SRS.
#define PROJECTION_LL
Projection code - Latitude-Longitude.
2D/3D raster map header (used also for region)
double north
Extent coordinates (north)
double east
Extent coordinates (east)
double south
Extent coordinates (south)
double west
Extent coordinates (west)