Przeglądaj źródła

v.out.ogr: preserve previous attribute export with GDAL 2.2+

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@71433 15284696-431f-4ddb-bdfa-cd5b030d7da7
Markus Metz 7 lat temu
rodzic
commit
63c4ab2870
1 zmienionych plików z 8 dodań i 0 usunięć
  1. 8 0
      vector/v.out.ogr/attrb.c

+ 8 - 0
vector/v.out.ogr/attrb.c

@@ -94,7 +94,11 @@ int mk_att(int cat, struct field_info *Fi, dbDriver *driver, int ncol,
 		    /* Reset */
 		    if ((nocat && strcmp(Fi->key, colname[j]) == 0) == 0) {
 			/* if this is 'cat', then execute the following only if the '-s' flag was NOT given*/
+#if GDAL_VERSION_NUM >= 2020000
+			OGR_F_SetFieldNull(Ogr_feature, ogrfieldnum);
+#else
 			OGR_F_UnsetField(Ogr_feature, ogrfieldnum);
+#endif
 		    }
 
 		    /* prevent writing NULL values */
@@ -129,6 +133,10 @@ int mk_att(int cat, struct field_info *Fi, dbDriver *driver, int ncol,
 			    }
 			}
 		    }
+#if GDAL_VERSION_NUM >= 2020000
+		    else
+			OGR_F_SetFieldNull(Ogr_feature, ogrfieldnum);
+#endif
 		}
 	    }
 	    db_close_cursor(&cursor);