[gdal-dev] 2.2.0beta1 regression NULL values

Roger Bivand Roger.Bivand at nhh.no
Fri Apr 21 01:12:35 PDT 2017


See https://github.com/edzer/sfr/issues/309 - < 2.2.0 we could write 
"missing values" in vector drivers and read them back. In 2.2.0beta1, we 
see REAL "missing values" written out OK, but read back as numeric zero. 
We've only checked shapefiles and GPKG so far.

Is this RFC 67? Until now, rgdal code (and likely sf) has used:

       case OFTReal:
 	if (poFeature->IsFieldSet(iField))
           REAL(ans)[iRow]=poFeature->GetFieldAsDouble(iField);
 	else REAL(ans)[iRow]=NA_REAL;
 	break;

and the same for other field and list field types. Should we be using:

int    CPL_DLL OGR_F_IsFieldSetAndNotNull( OGRFeatureH, int );

and should we be writing:

void   CPL_DLL OGR_F_SetFieldNull( OGRFeatureH, int );

instead of leaving the field unset with for example:

              if (!ISNA(NUMERIC_POINTER(VECTOR_ELT(ldata, j))[i]))
                  poFeature->SetField( CHAR(STRING_ELT(fld_names, j)),
                      NUMERIC_POINTER(VECTOR_ELT(ldata, j))[i] );

that is jumping over features for which the field value coming from R is 
missing?

We'd need to condition on GDAL version here (too), I guess.

Was this regression intended?

Best wishes,

Roger

-- 
Roger Bivand
Department of Economics, Norwegian School of Economics,
Helleveien 30, N-5045 Bergen, Norway.
voice: +47 55 95 93 55; e-mail: Roger.Bivand at nhh.no
Editor-in-Chief of The R Journal, https://journal.r-project.org/index.html
http://orcid.org/0000-0003-2392-6140
https://scholar.google.no/citations?user=AWeghB0AAAAJ&hl=en


More information about the gdal-dev mailing list