Quantcast

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

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

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

Paul Meems
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.

Thanks,

Paul

_______________________________________________
gdal-dev mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/gdal-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How does OGRFeature::GetFieldAsDouble handle NULL values

Nyall Dawson


On 6 Jan 2017 7:37 AM, "Paul Meems" <[hidden email]> 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.

Try Feature->IsFieldSet(...)


That should return false for null values.

Nyall


Thanks,

Paul

_______________________________________________
gdal-dev mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/gdal-dev


_______________________________________________
gdal-dev mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/gdal-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How does OGRFeature::GetFieldAsDouble handle NULL values

Paul Meems
Thanks Nyall,

Looking at the documentation it seems to be what I'm looking for.

Thanks,

Paul

Paul Meems 
Release manager, configuration manager
and forum moderator of MapWindow GIS.
www.mapwindow.org

Owner of MapWindow.nl - Support for
Dutch speaking users.
www.mapwindow.nl


The MapWindow GIS project has moved to GitHub!


Download the latest MapWinGIS mapping engine.

Download the latest MapWindow 5 open source desktop application.


2017-01-05 23:24 GMT+01:00 Nyall Dawson <[hidden email]>:


On 6 Jan 2017 7:37 AM, "Paul Meems" <[hidden email]> 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.

Try Feature->IsFieldSet(...)


That should return false for null values.

Nyall


Thanks,

Paul

_______________________________________________
gdal-dev mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/gdal-dev



_______________________________________________
gdal-dev mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/gdal-dev
Loading...