[gdal-dev] ShapeLib/GDAL support for Dates and Booleans

Jerry Faust jerryfaust1 at gmail.com
Wed Feb 21 22:34:28 PST 2018


Hello.

My name is Jerry Faust, and I'm a recent contributor to MapWinGIS.  We
provide GDAL/OGR layer support, and we use the embedded ShapeLib calls to
work with Shapefiles as our primary data source.  Specifically, we make
direct DBF calls into dbfopen.c through gdal2xx.dll, bypassing the
OGRDatasource/OGRLayer wrappers.

We are looking to add support for Date and Boolean field types, and while I
had thought that perhaps I could add support without having to change
anything within ShapeLib or OGR, alas, I could not.  Inevitably, since the
dates are stored as Integers, having the 'N' field descriptor rather than
the 'D' field descriptor, our code had no way to determine that the field
was a Date as opposed to an Integer.



I believe that the OGR constructs handle these issues through the OGR Field
Definition, but since we bypass those constructs, we get the data back in a
more 'raw' form.  There are similar issues with the Logical field type (not
with ShapeLib, but with OGR).

Interestingly, is appears that ShapeLib is very close to supporting Dates
altogether, with various 'if' and 'switch' statements checking for the 'D'
descriptor.  I presume this is because you have to be able to read
Shapefiles created externally, which would have the 'D' descriptor, but you
don't save them that way.

I have made minimal changes to ShapeLib files (Shapefil.h and dbfopen.c) in
an effort to add raw Date and Logical support, and had to make a couple
small changes to the OGR code as well (making sure that Shapefiles saved
through the modified ShapeLib are still readable with OGR).

I would like to submit these changes for review, in hopes that something
along these lines could be integrated into the official release.  I
acknowledge that there may be things I don't yet understand, and that
perhaps there are better ways to do what I have done, but it's a starting
point.

How would I go about submitting these changes for consideration?

Thank you.


Kind Regards.
Jerry Faust.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20180221/761b86e7/attachment-0001.html>


More information about the gdal-dev mailing list