gis - How does a SHX-file work? -


If you have geographic data stored in ESRI shapes, then you have at least three files: with a .shp The end in which the vector-data, containing the ADB containing attributes and the ending file containing an index containing .shx

I am interested in shx-file how does this work? Is there a complete mapping in it, such as 'first geometry maps for the first line of each geometry for DBF and third line in the second geometry map?' Or does it work differently? According to Shx there is a byte header, after which sequence 1 2 2 8 byte records each record a 4 byte offset and main to the length of a main box material. The SP records in the data file.

  + --------------- ------------------------ -------- + | Header (100 bytes). + ----------------- + ------------------ + ---------- + | Offset (4 bytes). Length (4 bytes). + ----------------- + ------------------ + | | Offset (4 bytes). Length (4 bytes). + ----------------- + ------------------ + | | Offset (4 bytes). Length (4 bytes). + ----------------- + ------------------ + | | Offset (4 bytes). Length (4 bytes). + ----------------- + ------------------ + | | .... | + ----------------- + ------------------ +  

note Offset is specified in 16-bit terms, so the offset for the first record is 50 (as the .shp header is 100 bytes or 50 words, long). Content length is also specified in 16-bit terms.

So, you can find the number of records from (index_file_length-100) / 8 , and use the index to use random .shp file in the random Or in order to record a special shape.


Comments