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

Even Rouault even.rouault at spatialys.com
Thu Feb 22 01:33:09 PST 2018


Jerry,
> 
> 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.

Note that this shapelib integrated in GDAL is considered as an internal detail of GDAL and 
that some builds might have the shapelib symbols hidden (will be the case in GDAL 2.3 on 
Unix builds)

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

Where do you find that dates are stored with N field descriptor ? OGR writes and read them 
with D descriptor, 8 characters width and store values as decimal numbers of value YY * 
10000 + MM * 100 + DD.

> 
> 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).

Yes I realized that we haven't upgraded the OGR side to convert DBF Logical field type to 
(OFTInteger, OFSTBoolean). But I failed to find DBF files  in the wild with logical field types.

> 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?

I'd suggest a pull request against the github mirror at
https://github.com/OSGeo/gdal

Even

-- 
Spatialys - Geospatial professional services
http://www.spatialys.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20180222/434e6337/attachment.html>


More information about the gdal-dev mailing list