[GRASS-SVN] r58387 - grass/trunk/lib/vector/Vlib

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Dec 4 14:34:33 PST 2013


Author: martinl
Date: 2013-12-04 14:34:32 -0800 (Wed, 04 Dec 2013)
New Revision: 58387

Modified:
   grass/trunk/lib/vector/Vlib/write_pg.c
Log:
vlib/pg: support SF_UNKNOWN (for empty layers)


Modified: grass/trunk/lib/vector/Vlib/write_pg.c
===================================================================
--- grass/trunk/lib/vector/Vlib/write_pg.c	2013-12-04 17:14:27 UTC (rev 58386)
+++ grass/trunk/lib/vector/Vlib/write_pg.c	2013-12-04 22:34:32 UTC (rev 58387)
@@ -718,6 +718,9 @@
     case (SF_POLYGON25D):
         geom_type = "POLYGONZ";
         break;
+    case (SF_UNKNOWN):
+        geom_type = "GEOMETRY";
+        break;
     default:
         G_warning(_("Unsupported feature type %d"), pg_info->feature_type);
         Vect__execute_pg(pg_info->conn, "ROLLBACK");
@@ -1065,6 +1068,7 @@
             pg_info->conninfo, pg_info->table_name, type);
 
     /* determine geometry type */
+    
     switch (type) {
     case GV_POINT:
         pg_info->feature_type = SF_POINT;
@@ -1078,7 +1082,10 @@
     case GV_FACE:
         pg_info->feature_type = SF_POLYGON25D;
         break;
-    default:
+    case -2:
+        pg_info->feature_type = SF_UNKNOWN;
+        break;
+    default: 
         G_warning(_("Unsupported geometry type (%d)"), type);
         return -1;
     }
@@ -1149,6 +1156,8 @@
         return "LINE";
     else if (sftype == SF_POLYGON)
         return "POLYGON";
+    else if (sftype == SF_UNKNOWN || sftype == SF_GEOMETRYCOLLECTION)
+        return "COLLECTION";
     else
         G_warning(_("Unsupported feature type %d"), sftype);
     



More information about the grass-commit mailing list