[GRASS-SVN] r67451 - grass/trunk/vector/v.out.ogr

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Dec 31 02:31:02 PST 2015


Author: mlennert
Date: 2015-12-31 02:31:02 -0800 (Thu, 31 Dec 2015)
New Revision: 67451

Modified:
   grass/trunk/vector/v.out.ogr/export_areas.c
   grass/trunk/vector/v.out.ogr/export_lines.c
Log:
v.out.ogr: Forcing use of OGR_G_AddPoint_2D when map is not 3D (attempt to fix #2300 "")


Modified: grass/trunk/vector/v.out.ogr/export_areas.c
===================================================================
--- grass/trunk/vector/v.out.ogr/export_areas.c	2015-12-31 10:28:06 UTC (rev 67450)
+++ grass/trunk/vector/v.out.ogr/export_areas.c	2015-12-31 10:31:02 UTC (rev 67451)
@@ -298,8 +298,12 @@
     
     /* Area */
     for (j = 0; j < Points->n_points; j++) {
-        OGR_G_AddPoint(ring, Points->x[j], Points->y[j],
-                       Points->z[j]);
+	if (Vect_is_3d(In))
+	        OGR_G_AddPoint(ring, Points->x[j], Points->y[j],
+        	               Points->z[j]);
+	else
+	        OGR_G_AddPoint_2D(ring, Points->x[j], Points->y[j]);
+        	               
     }
     
     OGR_G_AddGeometryDirectly(Ogr_geometry, ring);
@@ -311,8 +315,12 @@
         
         ring = OGR_G_CreateGeometry(wkbLinearRing);
         for (j = 0; j < Points->n_points; j++) {
-            OGR_G_AddPoint(ring, Points->x[j], Points->y[j],
-                           Points->z[j]);
+	    if(Vect_is_3d(In))
+	            OGR_G_AddPoint(ring, Points->x[j], Points->y[j],
+	                           Points->z[j]);
+	    else
+	            OGR_G_AddPoint_2D(ring, Points->x[j], Points->y[j]);
+
         }
         OGR_G_AddGeometryDirectly(Ogr_geometry, ring);
     }

Modified: grass/trunk/vector/v.out.ogr/export_lines.c
===================================================================
--- grass/trunk/vector/v.out.ogr/export_lines.c	2015-12-31 10:28:06 UTC (rev 67450)
+++ grass/trunk/vector/v.out.ogr/export_lines.c	2015-12-31 10:31:02 UTC (rev 67451)
@@ -94,13 +94,17 @@
             Ogr_geometry = OGR_G_CreateGeometry(get_wkbtype(type, otype));
             if (OGR_G_GetGeometryType(Ogr_geometry) == wkbPoint) {
                 /* GV_POINTS -> wkbPoint */
-                OGR_G_AddPoint(Ogr_geometry, Points->x[0], Points->y[0],
-                               Points->z[0]);
+		if (Vect_is_3d(In))
+	                OGR_G_AddPoint(Ogr_geometry, Points->x[0], Points->y[0],
+        	                       Points->z[0]);
+		else OGR_G_AddPoint_2D(Ogr_geometry, Points->x[0], Points->y[0]);
             }
             else { /* GV_LINES -> wkbLinestring */
                 for (j = 0; j < Points->n_points; j++) {
-                    OGR_G_AddPoint(Ogr_geometry, Points->x[j], Points->y[j],
-                                   Points->z[j]);
+		if (Vect_is_3d(In))
+	                OGR_G_AddPoint(Ogr_geometry, Points->x[j], Points->y[j],
+        	                       Points->z[j]);
+		else OGR_G_AddPoint_2D(Ogr_geometry, Points->x[j], Points->y[j]);
                 }
             }
         }



More information about the grass-commit mailing list