Closed KubaSzostak closed 1 year ago
Here is how GDAL/OGR evaluates a dbase field for NULL: https://github.com/OSGeo/gdal/blob/master/ogr/ogrsf_frmts/shape/dbfopen.c#L1102-L1143
Is that conformant to how we do it here?
Is that conformant to how we do it here?
looks the same handling implemented here to me
Is that conformant to how we do it here?
"00000000"
check fot Date fields. '?'
. In our code everything but TtYy
and FfNn
is treated as NULL. Should I make it conformant with GDAL?
- Additionally I will add missing
"00000000"
check for Date fields.
That is good.
- For Logical fields they check only for
'?'
. In our code everything butTtYy
andFfNn
is treated as NULL. Should I make it conformant with GDAL?
I'd say so, this way we reduce the chance of having to fix it later on. I assume that everything else beside "TtYy"
and "?"
is treated as false in GDAL/OGR.
I assume that everything else beside "TtYy" and "?" is treated as false in GDAL/OGR.
I don't know how it's treated in GDAL. The TtYy
and FfNn
is my ideat to get logical value from character not always within DBASE specification. I don't know how GDAL is dealing with this. I will check it and make it conformant with GDAL.
It seems like GDAL/OGR Shapefile driver does not do any explicit conversion to bool and just passes a pointer ot the character. In QGIS you can't create a Dbase field of type logical/bool. So we are a bit on our own.
I'd say we can safely convert TtYy1
to true
and any other value to false
. ?
is null. Maybe instead of just 1
we can treat any number character != 0 as true
.
According to https://www.clicketyclick.dk/databases/xbase/format/data_types.html#DATA_TYPES
"TtYy"
-> true
"FfNn"
-> false
"?"
(|| " "
) -> null
QGIS reads numeric fields filled with
*
character. Esri also does not complain. Now NetTopologySuite.IO.Esri will also support it. Fix #11.