0

I'm trying to read a .shp file. That .shp file contains polygon type. So I read all the records perfectly, after the reading the points, end of the file that have some 28 bytes are there what is meaning of that. same as I have 482 points in that shapefile. I calculate the content length by multiply the 8 bytes for each points so I Got 3856. but I read the value by reading of corresponding bytes, I got 3882. What is the meaning of that extra value?

4
  • Have a read of chrome-extension://efaidnbmnnnibpcajpcglclefindmkaj/esri.com/content/dam/esrisites/sitecore-archive/Files/Pdfs/… the Esri white paper on the shapefile format; if you're getting down to the byte level your should be able to understand the content. Oct 13, 2023 at 7:19
  • why are you worrying about the bytes of the file - QGis will handle all of this for you
    – Ian Turton
    Oct 13, 2023 at 7:39
  • I want to encode shapefile so I want to know about the all bytes
    – Sai Ganesh
    Oct 13, 2023 at 7:56
  • 1
    You can't know all the bytes, because it's possible to have CAD objects after the geometry before the next record. The .shx contains the starting offset for such "holey" files. You don't specify the number of features or rings, so it's impossible to figure out what the size should be.
    – Vince
    Oct 13, 2023 at 14:36

1 Answer 1

1

The byte content of a shapefile is described in this whitepaper.

It will show you that a shapefile does not only contain point coordinates, but also a file header of 100 bytes, and record headers of 8 bytes each.

The geometry storage also has extra information, beside the actual coordinates. For polygons, that extra information contains its bounding box, the number of parts, and the number of vertices.

And finally, the file size also depends on whether coordinates have M and Z values.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.