[gdal-dev] Re: Revision 1.55

Frank Warmerdam warmerdam at pobox.com
Mon Dec 17 10:08:57 EST 2007


Martin Chapman wrote:
> * Revision 1.55  2007/11/21 22:39:56  fwarmerdam
> 
>  * close shx file in readonly mode (GDAL #1956)
> 
>  
> 
> Frank,
> 
>  
> 
> Food for thought on this bug, closing access to the shape index file in 
> read only mode or any other mode makes little sense since that will 
> remove random access capability for the driver and all record fetches 
> will have to operate in a sequential fashion.  Not sure if it was just a 
> mistake or was there some other thought behind closing the shx file in 
> read only mode?

Martin,

I believe SHPOpen() reads the whole contents of the .shx file into memory
on open so there is no particular reason to keep it open.  The assumption
is that one (or two?) four byte integer values per shape is an acceptable
memory load and removes the need to seek around in the .shx file for
each shp read.

Make sense?

> Also, what are SAHooks?

"Shapefile API Hooks" is a structure of hook functions for IO, error reporting
and possibly other operations making it easier for applications to control how
low level operations are done by shapelib.  My preliminary need for this was to
support larger than 2GB file io on .dbf files.  But it also offers the option
of all-in-memory operation, better control over file open (to support UTF8 or
possibly wchar filenames), better error reporting and such.

This is a step towards a Shapelib 1.3 release but in the meantime I
downstreamed the development shapelib code into GDAL/OGR to get the large
file io support.

With regard to the problem you noted in your earlier message, I have
committed change:

   http://trac.osgeo.org/gdal/changeset/13355

This checks fpSHX before calling fflush() on it.  I think this is the more
appropriate correction.

You indicated a concern that with the .shx file closed non-sequential access
is no longer fast.  If you believe this is still the case, could you please
provide some more information?  I will be cutting a release candidate this
evening so knowing sooner is better.

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | President OSGeo, http://osgeo.org




More information about the gdal-dev mailing list