Frank Warmerdam wrote: > The .shx file contains the offset of each shape in the .shp file. > So, essentially you can think of it as an "index" built on the shapeid. > > Without it, if you wanted shape 1034 in abc.shp you would need to > scan through from the beginning, counting as you process shapes, > till you found the 1034th. With the .shx you can just lookup the 1034th > entry in the .shx to get the file offset in the .shp to go to. > > The .shx is really only important for variable length shapes. So for > point files it is unnecessary since all points are the same length. > But for lines and polygons it helps alot for lookup-by-index.
Until recently, my software read SHP files without using the SHX, simply by sequential record reading. We didn't need random-access, so this was easy enough. Also, we'd encountered situations where a user had mistakenly omitted the SHX file in transferring data.
A few weeks ago, this was blown out of the water by a SHP file I received, allegedly written by an ESRI product (never did establish the exact ancestry of the file/data). In this file, two records were separated (786 records in...) by some junk padding data. The SHX file correctly indicated that the 787th record began some distance after where the 786th record ended.
Our sequential reader had no way to cope with the problem.
Thus, we added SHX support, and if the SHX file is missing, we fall back to the sequential reader.
The SHP world is a strange place indeed.
> Best regards,
-- Chris 'Xenon' Hanson, omo sanze lettere Xenon AlphaPixel.com PixelSense Landsat processing now available! http://www.alphapixel.com/demos/ "There is no Truth. There is only Perception. To Perceive is to Exist." - Xen _______________________________________________ gislist mailing list gislist@lists.geocomm.com http://lists.geocomm.com/mailman/listinfo/gislist
_________________________________ This list is brought to you by The GeoCommunity http://www.geocomm.com/
|