[GRASS-SVN] r72440 - grass/trunk/lib/proj

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Mar 20 12:51:46 PDT 2018


Author: mmetz
Date: 2018-03-20 12:51:46 -0700 (Tue, 20 Mar 2018)
New Revision: 72440

Modified:
   grass/trunk/lib/proj/do_proj.c
   grass/trunk/lib/proj/do_proj_ll.c
Log:
libproj: use 4D type with PROJ 5+

Modified: grass/trunk/lib/proj/do_proj.c
===================================================================
--- grass/trunk/lib/proj/do_proj.c	2018-03-20 19:34:25 UTC (rev 72439)
+++ grass/trunk/lib/proj/do_proj.c	2018-03-20 19:51:46 UTC (rev 72440)
@@ -99,10 +99,10 @@
 
     if (strncmp(info_in->proj, "ll", 2) == 0) {
 	/* convert to radians */
-	c.lp.lam = (*x) / RAD_TO_DEG;
-	c.lp.phi = (*y) / RAD_TO_DEG;
-	c.lp.z = 0;
-	c.lp.t = 0;
+	c.lpzt.lam = (*x) / RAD_TO_DEG;
+	c.lpzt.phi = (*y) / RAD_TO_DEG;
+	c.lpzt.z = 0;
+	c.lpzt.t = 0;
 	c = proj_trans(P, PJ_FWD, c);
 	ok = proj_errno(P);
 
@@ -119,10 +119,10 @@
     }
     else {
 	/* convert to meters */
-	c.xy.x = *x * METERS_in;
-	c.xy.y = *y * METERS_in;
-	c.xy.z = 0;
-	c.xy.t = 0;
+	c.xyzt.x = *x * METERS_in;
+	c.xyzt.y = *y * METERS_in;
+	c.xyzt.z = 0;
+	c.xyzt.t = 0;
 	c = proj_trans(P, PJ_FWD, c);
 	ok = proj_errno(P);
 
@@ -245,13 +245,13 @@
     }
     ok = 0;
     if (strncmp(info_in->proj, "ll", 2) == 0) {
-	c.lp.t = 0;
+	c.lpzt.t = 0;
 	if (strncmp(info_out->proj, "ll", 2) == 0) {
 	    for (i = 0; i < count; i++) {
 		/* convert to radians */
-		c.lp.lam = x[i] / RAD_TO_DEG;
-		c.lp.phi = y[i] / RAD_TO_DEG;
-		c.lp.z = h[i];
+		c.lpzt.lam = x[i] / RAD_TO_DEG;
+		c.lpzt.phi = y[i] / RAD_TO_DEG;
+		c.lpzt.z = h[i];
 		c = proj_trans(P, PJ_FWD, c);
 		if ((ok = proj_errno(P)) < 0)
 		    break;
@@ -263,9 +263,9 @@
 	else {
 	    for (i = 0; i < count; i++) {
 		/* convert to radians */
-		c.lp.lam = x[i] / RAD_TO_DEG;
-		c.lp.phi = y[i] / RAD_TO_DEG;
-		c.lp.z = h[i];
+		c.lpzt.lam = x[i] / RAD_TO_DEG;
+		c.lpzt.phi = y[i] / RAD_TO_DEG;
+		c.lpzt.z = h[i];
 		c = proj_trans(P, PJ_FWD, c);
 		if ((ok = proj_errno(P)) < 0)
 		    break;
@@ -276,13 +276,13 @@
 	}
     }
     else {
-	c.xy.t = 0;
+	c.xyzt.t = 0;
 	if (strncmp(info_out->proj, "ll", 2) == 0) {
 	    for (i = 0; i < count; i++) {
 		/* convert to meters */
-		c.xy.x = x[i] * METERS_in;
-		c.xy.y = y[i] * METERS_in;
-		c.xy.z = h[i];
+		c.xyzt.x = x[i] * METERS_in;
+		c.xyzt.y = y[i] * METERS_in;
+		c.xyzt.z = h[i];
 		c = proj_trans(P, PJ_FWD, c);
 		if ((ok = proj_errno(P)) < 0)
 		    break;
@@ -294,9 +294,9 @@
 	else {
 	    for (i = 0; i < count; i++) {
 		/* convert to meters */
-		c.xy.x = x[i] * METERS_in;
-		c.xy.y = y[i] * METERS_in;
-		c.xy.z = h[i];
+		c.xyzt.x = x[i] * METERS_in;
+		c.xyzt.y = y[i] * METERS_in;
+		c.xyzt.z = h[i];
 		c = proj_trans(P, PJ_FWD, c);
 		if ((ok = proj_errno(P)) < 0)
 		    break;

Modified: grass/trunk/lib/proj/do_proj_ll.c
===================================================================
--- grass/trunk/lib/proj/do_proj_ll.c	2018-03-20 19:34:25 UTC (rev 72439)
+++ grass/trunk/lib/proj/do_proj_ll.c	2018-03-20 19:51:46 UTC (rev 72440)
@@ -83,8 +83,10 @@
 	/* from ll to projected */
 
 	/* convert to radians */
-	c.lp.lam = (*x) / RAD_TO_DEG;
-	c.lp.phi = (*y) / RAD_TO_DEG;
+	c.lpzt.lam = (*x) / RAD_TO_DEG;
+	c.lpzt.phi = (*y) / RAD_TO_DEG;
+	c.lpzt.z = 0;
+	c.lpzt.t = 0;
 
 	c = proj_trans(P, PJ_FWD, c);
 	ok = proj_errno(P);
@@ -97,8 +99,10 @@
 	/* from projected to ll */
 
 	/* convert to meters */
-	c.xy.x = *x * METERS_in;
-	c.xy.y = *y * METERS_in;
+	c.xyzt.x = *x * METERS_in;
+	c.xyzt.y = *y * METERS_in;
+	c.xyzt.z = 0;
+	c.xyzt.t = 0;
 
 	c = proj_trans(P, PJ_INV, c);
 	ok = proj_errno(P);
@@ -178,8 +182,10 @@
 
 	for (i = 0; i < count; i++) {
 	    /* convert to radians */
-	    c.lp.lam = x[i] / RAD_TO_DEG;
-	    c.lp.phi = y[i] / RAD_TO_DEG;
+	    c.lpzt.lam = x[i] / RAD_TO_DEG;
+	    c.lpzt.phi = y[i] / RAD_TO_DEG;
+	    c.lpzt.z = h[i];
+	    c.lpzt.t = 0;
 
 	    c = proj_trans(P, PJ_FWD, c);
 	    if ((ok = proj_errno(P)) < 0)
@@ -195,8 +201,10 @@
 
 	for (i = 0; i < count; i++) {
 	    /* convert to meters */
-	    c.xy.x = x[i] * METERS_in;
-	    c.xy.y = y[i] * METERS_in;
+	    c.xyzt.x = x[i] * METERS_in;
+	    c.xyzt.y = y[i] * METERS_in;
+	    c.xyzt.z = h[i];
+	    c.xyzt.t = 0;
 
 	    c = proj_trans(P, PJ_INV, c);
 	    if ((ok = proj_errno(P)) < 0)



More information about the grass-commit mailing list