[GRASS-SVN] r72429 - grass/trunk/raster/r.horizon
svn_grass at osgeo.org
svn_grass at osgeo.org
Tue Mar 20 11:49:56 PDT 2018
Author: mmetz
Date: 2018-03-20 11:49:55 -0700 (Tue, 20 Mar 2018)
New Revision: 72429
Modified:
grass/trunk/raster/r.horizon/main.c
Log:
r.horizon: use new PROJ 5+ API if available
Modified: grass/trunk/raster/r.horizon/main.c
===================================================================
--- grass/trunk/raster/r.horizon/main.c 2018-03-20 18:48:30 UTC (rev 72428)
+++ grass/trunk/raster/r.horizon/main.c 2018-03-20 18:49:55 UTC (rev 72429)
@@ -540,6 +540,7 @@
G_free_key_value(in_proj_info);
G_free_key_value(in_unit_info);
+#ifndef HAVE_PROJ_H
/* Set output projection to latlong w/ same ellipsoid */
oproj.zone = 0;
oproj.meters = 1.;
@@ -546,6 +547,7 @@
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
/**********end of parser - ******************************/
@@ -842,7 +844,11 @@
longitude = xp;
latitude = yp;
+#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"));
}
}
@@ -860,7 +866,11 @@
latitude = (latitude + delt_lat) * rad2deg;
longitude = (longitude + delt_lon) * rad2deg;
+#ifdef HAVE_PROJ_H
+ if (GPJ_do_proj_ll(&longitude, &latitude, &iproj, PJ_FWD) < 0) {
+#else
if (pj_do_proj(&longitude, &latitude, &oproj, &iproj) < 0) {
+#endif
G_fatal_error(_("Error in pj_do_proj"));
}
@@ -1198,7 +1208,11 @@
if ((G_projection() != PROJECTION_LL)) {
- if (pj_do_proj(&longitude, &latitude, &iproj, &oproj) < 0)
+#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");
}
@@ -1218,7 +1232,11 @@
longitude = (longitude + delt_lon) * rad2deg;
if ((G_projection() != PROJECTION_LL)) {
+#ifdef HAVE_PROJ_H
+ if (GPJ_do_proj_ll(&longitude, &latitude, &iproj, PJ_FWD) < 0)
+#else
if (pj_do_proj(&longitude, &latitude, &oproj, &iproj) < 0)
+#endif
G_fatal_error("Error in pj_do_proj");
}
More information about the grass-commit
mailing list