[postgis-users] loading shapefiles into postgis db

Markus Schaber schabi at logix-tt.com
Fri Mar 4 08:58:12 PST 2005


Hi, strk,

strk at refractions.net schrieb:

>>The SHX contents is redundant as it can be regenerated from shp
>>contents. On the web, you find some tools that claim to do this, google
>>showed me http://www.geocities.com/SiliconValley/Haven/2295/useful.html
>>pointing to ShapeChecker (I did not test it myself).
> 
> I wonder why does shapelib insist on finding it ...

Because shapefile reading is easier when having the index :-)

The index file basically has a copy of the shapefile header, and then an
Array with offset + length for each records. So you can easily jump to
specific records.

But I just re-checked the Shapefile doc from ESRI, each record has
length and record numer in it. So if you have a "correct" shape file (e.
G. no garbage data _between_ records), shx can be recreated.

BTW, each record contains the geometry type, although all geometries
must be of the same type which is noted in the header. And they have the
weird habit of mixing both big and little endian in the same file, some
fields are big and some are little endian. Just a weird mess, IMHO :-)

Markus
-- 
Markus Schaber | Logical Tracking&Tracing International AG
Dipl. Inf.     | Software Development GIS

Fight against software patents in EU! www.ffii.org www.nosoftwarepatents.org



More information about the postgis-users mailing list