|
@@ -56,9 +56,8 @@ long calc_solar_position(double longitude, double latitude, double timezone,
|
|
|
long retval; /* to capture S_solpos return codes */
|
|
|
struct Key_Value *in_proj_info, *in_unit_info; /* projection information of input map */
|
|
|
struct pj_info iproj; /* input map proj parameters */
|
|
|
-#ifndef HAVE_PROJ_H
|
|
|
struct pj_info oproj; /* output map proj parameters */
|
|
|
-#endif
|
|
|
+ struct pj_info tproj; /* transformation parameters */
|
|
|
extern struct Cell_head window;
|
|
|
int inside;
|
|
|
|
|
@@ -114,21 +113,19 @@ long calc_solar_position(double longitude, double latitude, double timezone,
|
|
|
iproj.meters, iproj.zone, iproj.proj);
|
|
|
G_debug(1, "IN coord: longitude: %f, latitude: %f", longitude,
|
|
|
latitude);
|
|
|
- /* see src/include/projects.h, struct PJconsts */
|
|
|
-#ifndef HAVE_PROJ_H
|
|
|
- /* set output projection to lat/long for solpos */
|
|
|
- oproj.zone = 0;
|
|
|
- oproj.meters = 1.;
|
|
|
- sprintf(oproj.proj, "ll");
|
|
|
- if ((oproj.pj = pj_latlong_from_proj(iproj.pj)) == NULL)
|
|
|
- G_fatal_error("Unable to set up lat/long projection parameters");
|
|
|
-#endif
|
|
|
+
|
|
|
+ oproj.pj = NULL;
|
|
|
+
|
|
|
+ if (GPJ_init_transform(&iproj, &oproj, &tproj) < 0)
|
|
|
+ G_fatal_error(_("Unable to initialize coordinate transformation"));
|
|
|
+
|
|
|
/* XX do the transform
|
|
|
* outx outy in_info out_info */
|
|
|
|
|
|
- if (GPJ_do_proj_ll(&longitude, &latitude, &iproj, PJ_INV) < 0) {
|
|
|
- G_fatal_error(_("Error in pj_do_proj (projection of input coordinate pair)"));
|
|
|
- }
|
|
|
+ if (GPJ_transform(&iproj, &oproj, &tproj, PJ_FWD,
|
|
|
+ &longitude, &latitude, NULL) < 0)
|
|
|
+ G_fatal_error(_("Error in %s (projection of input coordinate pair)"),
|
|
|
+ "GPJ_transform()");
|
|
|
|
|
|
G_debug(1, "Transformation to lat/long:");
|
|
|
G_debug(1, "OUT: longitude: %f, latitude: %f", longitude,
|