[GRASS-stats] readVECT6 problem fo importing null data

Markus Neteler neteler at fbk.eu
Wed Dec 5 10:38:10 EST 2007


I am close but ...

RCS file: /home/grass/grassrepository/grass6/vector/v.out.ogr/main.c,v
retrieving revision 1.48
diff -u -r1.48 main.c
--- main.c      3 Oct 2007 09:40:32 -0000       1.48
+++ main.c      5 Dec 2007 15:34:50 -0000
@@ -630,8 +630,11 @@
                                OGR_F_SetFieldInteger( Ogr_feature, j,
db_get_value_int(Value) );
                                break;
                             case DB_C_TYPE_DOUBLE:
-                               OGR_F_SetFieldDouble( Ogr_feature, j,
db_get_value_double(Value) );
-                               break;
+                               if ( strlen(db_get_string (&dbstring)) != 0
)
+                                   OGR_F_SetFieldDouble( Ogr_feature, j,
db_get_value_double(Value) );
+                               else
+                                  G_debug(2, "skipping NULL field");
+                            break;
                             case DB_C_TYPE_STRING:
                                OGR_F_SetFieldString( Ogr_feature, j,
db_get_value_string(Value) );
                                break;

should skip the field if NULL was found. but still 0 is inserted.

I suspect that OGR_F_UnsetField() is the problem which is used in line 597
etc.
http://www.gdal.org/ogr/ogr__api_8h.html#a70b7675a003141e63f9603c752ee22e

    /* Attributes */
    /* Reset */
    if ( doatt ) {
        for (j = 0; j < ncol; j++) OGR_F_UnsetField(Ogr_feature, j);
    } else {
        OGR_F_UnsetField(Ogr_feature, 0);
    }

No idea how to solve this but cannot be so hard.

Markus
-- 
View this message in context: http://www.nabble.com/-GRASS-stats--readVECT6-problem-fo-importing-null-data-tf4876840.html#a14174046
Sent from the Grass - Stats mailing list archive at Nabble.com.



More information about the grass-stats mailing list