[GRASS-SVN] r67569 - grass/branches/releasebranch_7_0/vector/v.out.ogr

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Jan 12 08:59:55 PST 2016


Author: martinl
Date: 2016-01-12 08:59:55 -0800 (Tue, 12 Jan 2016)
New Revision: 67569

Modified:
   grass/branches/releasebranch_7_0/vector/v.out.ogr/export_areas.c
   grass/branches/releasebranch_7_0/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)
           (merge r67451, r67568 from trunk)


Modified: grass/branches/releasebranch_7_0/vector/v.out.ogr/export_areas.c
===================================================================
--- grass/branches/releasebranch_7_0/vector/v.out.ogr/export_areas.c	2016-01-12 16:55:45 UTC (rev 67568)
+++ grass/branches/releasebranch_7_0/vector/v.out.ogr/export_areas.c	2016-01-12 16:59:55 UTC (rev 67569)
@@ -298,8 +298,11 @@
     
     /* 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 +314,11 @@
         
         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/branches/releasebranch_7_0/vector/v.out.ogr/export_lines.c
===================================================================
--- grass/branches/releasebranch_7_0/vector/v.out.ogr/export_lines.c	2016-01-12 16:55:45 UTC (rev 67568)
+++ grass/branches/releasebranch_7_0/vector/v.out.ogr/export_lines.c	2016-01-12 16:59:55 UTC (rev 67569)
@@ -94,13 +94,19 @@
             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