[GRASS-SVN] r72518 - grass/trunk/raster/r.sunmask
svn_grass at osgeo.org
svn_grass at osgeo.org
Fri Mar 23 02:25:04 PDT 2018
Author: mmetz
Date: 2018-03-23 02:25:04 -0700 (Fri, 23 Mar 2018)
New Revision: 72518
Modified:
grass/trunk/raster/r.sunmask/g_solposition.c
Log:
r.sunmask: use new GRASS API for coordinate transformation
Modified: grass/trunk/raster/r.sunmask/g_solposition.c
===================================================================
--- grass/trunk/raster/r.sunmask/g_solposition.c 2018-03-23 09:24:52 UTC (rev 72517)
+++ grass/trunk/raster/r.sunmask/g_solposition.c 2018-03-23 09:25:04 UTC (rev 72518)
@@ -56,9 +56,8 @@
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 @@
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,
More information about the grass-commit
mailing list