[Gdal-dev] Content length field mismatch in shapefiles

Roger Bivand Roger.Bivand at nhh.no
Mon May 1 12:55:36 EDT 2006


On Mon, 1 May 2006, Frank Warmerdam wrote:

> Roger Bivand wrote:
> > If anyone can see errors of interpretation here, I'd be grateful. I don't 
> > think this fix can be applied to OGR/shapelib from the API, though, is 
> > that right?
> 
> Roger,
> 
> I'm hesitant to incorporate such a change into shapelib for fear it will
> make things very fragile.  I would kind of like to make Shapelib support
> shp files without a .shx file (perhaps generating it as a prepass).  If we
> had that, I think folks with geolytics files could just delete their .shx
> file and let shapelib regenerate it properly.  However, I'm not likely to
> do this myself in the near future.

Frank,

> 
> Generally speaking trying to deal with other folks broken writers can
> be a very frustrating and somewhat dangerous direction.  And it isn't one I'm
> likely to do for fun.
> 

I quite agree. The posted solution works for stand-alone shapelib people. 
I also agree that a *.shx verifier and re-builder would be a way round 
which would work for OGR users if information that the length of *.shp and 
the implied length in the *.shx don't agree. Naturally there can be lots 
of other pathological shx/shp varieties out there, it was interesting to 
see just how dumb this one was.

Shall I write a very small shapelib contrib function/program to test for 
this malformity?

Best wishes,

Roger

> Best regards,
> 

-- 
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand at nhh.no




More information about the Gdal-dev mailing list