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

svn_grass at osgeo.org svn_grass at osgeo.org
Sun Aug 21 16:28:05 EDT 2011


Author: martinl
Date: 2011-08-21 13:28:05 -0700 (Sun, 21 Aug 2011)
New Revision: 47799

Modified:
   grass/trunk/lib/vector/Vlib/write_ogr.c
Log:
vlib: ignore fid column when writing attributes for OGR layers


Modified: grass/trunk/lib/vector/Vlib/write_ogr.c
===================================================================
--- grass/trunk/lib/vector/Vlib/write_ogr.c	2011-08-21 20:18:57 UTC (rev 47798)
+++ grass/trunk/lib/vector/Vlib/write_ogr.c	2011-08-21 20:28:05 UTC (rev 47799)
@@ -417,7 +417,8 @@
 	sqltype = db_get_column_sqltype(column);
 	ogrtype = sqltype_to_ogrtype(sqltype);
 		
-	if (OGR_FD_GetFieldIndex(hFeatureDefn, colname) > -1) {
+	if (strcmp(OGR_L_GetFIDColumn(hLayer), colname) == 0 ||
+	    OGR_FD_GetFieldIndex(hFeatureDefn, colname) > -1) {
 	    /* field already exists */
 	    continue;
 	}
@@ -425,7 +426,7 @@
 	hFieldDefn = OGR_Fld_Create(colname, ogrtype);
 	/* OGR_Fld_SetWidth(hFieldDefn, length); */
 	if (OGR_L_CreateField(hLayer, hFieldDefn, TRUE) != OGRERR_NONE) {
-	    G_warning(_("Creating field <%s> failed\n"), colname);
+	    G_warning(_("Creating field <%s> failed"), colname);
 	    db_close_database_shutdown_driver(driver);
 	    return NULL;
 	}



More information about the grass-commit mailing list