[GRASS-SVN] r54116 - grass/branches/releasebranch_6_4/lib/vector/Vlib

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Nov 30 08:11:58 PST 2012


Author: martinl
Date: 2012-11-30 08:11:57 -0800 (Fri, 30 Nov 2012)
New Revision: 54116

Modified:
   grass/branches/releasebranch_6_4/lib/vector/Vlib/open_ogr.c
Log:
vlib: V1_open_old_ogr() fix for 3D data


Modified: grass/branches/releasebranch_6_4/lib/vector/Vlib/open_ogr.c
===================================================================
--- grass/branches/releasebranch_6_4/lib/vector/Vlib/open_ogr.c	2012-11-30 15:45:47 UTC (rev 54115)
+++ grass/branches/releasebranch_6_4/lib/vector/Vlib/open_ogr.c	2012-11-30 16:11:57 UTC (rev 54116)
@@ -48,7 +48,8 @@
     OGRDataSourceH Ogr_ds;
     OGRLayerH Ogr_layer = NULL;
     OGRFeatureDefnH Ogr_featuredefn;
-
+    OGRwkbGeometryType Ogr_geom_type;
+    
     if (update) {
 	G_fatal_error(_("OGR format cannot be updated"));
 	return -1;
@@ -74,8 +75,8 @@
     for (i = 0; i < nLayers; i++) {
 	Ogr_layer = OGR_DS_GetLayer(Ogr_ds, i);
 	Ogr_featuredefn = OGR_L_GetLayerDefn(Ogr_layer);
-	if (strcmp(OGR_FD_GetName(Ogr_featuredefn), Map->fInfo.ogr.layer_name)
-	    == 0) {
+	if (strcmp(OGR_FD_GetName(Ogr_featuredefn), Map->fInfo.ogr.layer_name) == 0) {
+            Ogr_geom_type = OGR_FD_GetGeomType(Ogr_featuredefn);
 	    layer = i;
 	    break;
 	}
@@ -95,8 +96,17 @@
     Map->fInfo.ogr.lines_num = 0;
     Map->fInfo.ogr.lines_next = 0;
 
-    Map->head.with_z = WITHOUT_Z;	/* TODO: 3D */
-
+    switch(Ogr_geom_type) {
+    case wkbPoint25D: case wkbLineString25D: case wkbPolygon25D:
+    case wkbMultiPoint25D: case wkbMultiLineString25D: case wkbMultiPolygon25D:
+    case wkbGeometryCollection25D:
+        Map->head.with_z = WITH_Z;
+        break;
+    default:
+        Map->head.with_z = WITHOUT_Z;
+        break;
+    }
+    
     Map->fInfo.ogr.feature_cache = NULL;
     Map->fInfo.ogr.feature_cache_id = -1;	/* FID >= 0 */
 



More information about the grass-commit mailing list