[GRASS-SVN] r72433 - grass/trunk/raster/r.sunmask
svn_grass at osgeo.org
svn_grass at osgeo.org
Tue Mar 20 11:52:28 PDT 2018
Author: mmetz
Date: 2018-03-20 11:52:28 -0700 (Tue, 20 Mar 2018)
New Revision: 72433
Modified:
grass/trunk/raster/r.sunmask/g_solposition.c
Log:
r.sunmask: use new PROJ 5+ API if available
Modified: grass/trunk/raster/r.sunmask/g_solposition.c
===================================================================
--- grass/trunk/raster/r.sunmask/g_solposition.c 2018-03-20 18:51:34 UTC (rev 72432)
+++ grass/trunk/raster/r.sunmask/g_solposition.c 2018-03-20 18:52:28 UTC (rev 72433)
@@ -56,7 +56,9 @@
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
extern struct Cell_head window;
int inside;
@@ -113,7 +115,7 @@
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.;
@@ -120,10 +122,14 @@
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
/* XX do the transform
* outx outy in_info out_info */
+#ifdef HAVE_PROJ_H
+ if (GPJ_do_proj_ll(&longitude, &latitude, &iproj, PJ_INV) < 0) {
+#else
if (pj_do_proj(&longitude, &latitude, &iproj, &oproj) < 0) {
+#endif
G_fatal_error(_("Error in pj_do_proj (projection of input coordinate pair)"));
}
More information about the grass-commit
mailing list