[GRASS-SVN] r72432 - grass/trunk/raster/r.sunhours
svn_grass at osgeo.org
svn_grass at osgeo.org
Tue Mar 20 11:51:34 PDT 2018
Author: mmetz
Date: 2018-03-20 11:51:34 -0700 (Tue, 20 Mar 2018)
New Revision: 72432
Modified:
grass/trunk/raster/r.sunhours/main.c
Log:
r.sunhours: use new PROJ 5+ API if available
Modified: grass/trunk/raster/r.sunhours/main.c
===================================================================
--- grass/trunk/raster/r.sunhours/main.c 2018-03-20 18:51:07 UTC (rev 72431)
+++ grass/trunk/raster/r.sunhours/main.c 2018-03-20 18:51:34 UTC (rev 72432)
@@ -48,8 +48,9 @@
/* projection information of input map */
struct Key_Value *in_proj_info, *in_unit_info;
struct pj_info iproj; /* input map proj parameters */
+#ifndef HAVE_PROJ_H
struct pj_info oproj; /* output map proj parameters */
-
+#endif
char *elev_name, *azimuth_name, *sunhour_name;
int elev_fd, azimuth_fd, sunhour_fd;
double ha, ha_cos, s_gamma, s_elevation, s_azimuth;
@@ -223,7 +224,7 @@
G_free_key_value(in_proj_info);
G_free_key_value(in_unit_info);
-
+#ifndef HAVE_PROJ_H
/* output projection to lat/long w/ same ellipsoid as input */
oproj.zone = 0;
oproj.meters = 1.;
@@ -230,6 +231,7 @@
sprintf(oproj.proj, "ll");
if ((oproj.pj = pj_latlong_from_proj(iproj.pj)) == NULL)
G_fatal_error(_("Unable to update lat/long projection parameters"));
+#endif
}
/* always init pd */
@@ -292,7 +294,11 @@
north_ll = (window.north + window.south) / 2;
east_ll = (window.east + window.west) / 2;
if (do_reproj) {
+#ifdef HAVE_PROJ_H
+ if (GPJ_do_proj_ll(&east_ll, &north_ll, &iproj, PJ_INV) < 0)
+#else
if (pj_do_proj(&east_ll, &north_ll, &iproj, &oproj) < 0)
+#endif
G_fatal_error(_("Error in pj_do_proj (projection of input coordinate pair)"));
}
pd.timezone = east_ll / 15.;
@@ -386,8 +392,11 @@
if (do_reproj) {
north_ll = north;
-
+#ifdef HAVE_PROJ_H
+ if (GPJ_do_proj_ll(&east_ll, &north_ll, &iproj, PJ_INV) < 0)
+#else
if (pj_do_proj(&east_ll, &north_ll, &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