[gdal-dev] How does OGRFeature::GetFieldAsDouble handle NULL values

Nyall Dawson nyall.dawson at gmail.com
Thu Jan 5 14:24:13 PST 2017


On 6 Jan 2017 7:37 AM, "Paul Meems" <bontepaarden at gmail.com> wrote:

We're using GDAL v2.1.2 on Windows.

We use the GDAL library with MapWinGIS to connect to a PostGIS database.
When the PostGIS table has NULL values in integer, numeric or double fields
and that data is read the returned values are 0 (zero), which is unexpected
by us.

We use Feature->GetFieldAsDouble() and Feature->GetFieldAsInteger().
Am I correct that these function return 0 when the database value is NULL?
If not our implementation is wrong and I need to continue my search.
The documentation http://www.gdal.org/classOGRFeature.html#
ab8a57c94e8bb8ffac5e7048d896254b4 doesn't say either way.


Try Feature->IsFieldSet(...)

http://www.gdal.org/classOGRFeature.html#a7ad01c76b7b13bcf9eab5092aacac5fb

That should return false for null values.

Nyall


Thanks,

Paul

_______________________________________________
gdal-dev mailing list
gdal-dev at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20170106/a6f9049f/attachment.html>


More information about the gdal-dev mailing list