mmomtchev / node-gdal-async

Node.js bindings for GDAL (Geospatial Data Abstraction Library) with full async support
https://mmomtchev.github.io/node-gdal-async/
Apache License 2.0
129 stars 26 forks source link

Fix: NULL value always returned as an empty string or 0 #94

Closed kprabowo closed 1 year ago

kprabowo commented 1 year ago

https://github.com/OSGeo/gdal/blob/48a03529886ce185405d126c91898759442f55c4/MIGRATION_GUIDE.TXT#L269

MIGRATION GUIDE FROM GDAL 2.1 to GDAL 2.2
-----------------------------------------

B) RFC 67: Null values in OGR

Link: https://trac.osgeo.org/gdal/wiki/rfc67_nullfieldvalues

Previously, the "unset" state of a field was used both for a unset state
(ie no information for the field of the feature) or the NULL state of the
field. Now there is OGR_F_IsFieldSet() / OGRFeature::IsFieldSet() for the
unset state, and a new OGR_F_IsFieldNull() / OGRFeature::IsFieldNull() for the
new NULL state. Code that used OGR_F_IsFieldSet() / OGRFeature::IsFieldSet()
should also test the NULL state, otherwise empty strings or 0 numeric values
will be returned. A convenient way of migrating is to replace the use of
OGR_F_IsFieldSet() / OGRFeature::IsFieldSet() by OGR_F_IsFieldSetAndNotNull() /
OGRFeature::IsFieldSetAndNotNull() if there is no need to distinguish both
states.
kprabowo commented 1 year ago

Should change the minimum GDAL version to 2.2 in docs

codecov-commenter commented 1 year ago

Codecov Report

Patch coverage has no change and project coverage change: +0.01 :tada:

Comparison is base (4d4cc5b) 90.76% compared to head (a77e68b) 90.78%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #94 +/- ## ========================================== + Coverage 90.76% 90.78% +0.01% ========================================== Files 95 95 Lines 10676 10631 -45 ========================================== - Hits 9690 9651 -39 + Misses 986 980 -6 ``` | [Impacted Files](https://app.codecov.io/gh/mmomtchev/node-gdal-async/pull/94?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Momtchil+Momtchev) | Coverage Δ | | |---|---|---| | [src/collections/feature\_fields.cpp](https://app.codecov.io/gh/mmomtchev/node-gdal-async/pull/94?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Momtchil+Momtchev#diff-c3JjL2NvbGxlY3Rpb25zL2ZlYXR1cmVfZmllbGRzLmNwcA==) | `90.22% <ø> (+0.55%)` | :arrow_up: | ... and [1 file with indirect coverage changes](https://app.codecov.io/gh/mmomtchev/node-gdal-async/pull/94/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Momtchil+Momtchev)

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.