File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed
Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -2074,17 +2074,21 @@ def __shape(
20742074 # Convert from num of 16 bit words, to 8 bit bytes
20752075 recLength_bytes = 2 * recLength
20762076
2077- next_shape = f .tell () + recLength_bytes
2077+ # next_shape = f.tell() + recLength_bytes
20782078
2079- shapeType = unpack ("<i" , f .read (4 ))[0 ]
2079+ # Read entire record into memory
2080+ b_io = io .BytesIO (f .read (recLength_bytes ))
2081+ b_io .seek (0 )
2082+
2083+ shapeType = unpack ("<i" , b_io .read (4 ))[0 ]
20802084
20812085 ShapeClass = SHAPE_CLASS_FROM_SHAPETYPE [shapeType ]
2082- shape = ShapeClass .from_byte_stream (f , next_shape , oid = oid , bbox = bbox )
2086+ shape = ShapeClass .from_byte_stream (b_io , recLength_bytes , oid = oid , bbox = bbox )
20832087
20842088 # Seek to the end of this record as defined by the record header because
20852089 # the shapefile spec doesn't require the actual content to meet the header
20862090 # definition. Probably allowed for lazy feature deletion.
2087- f .seek (next_shape )
2091+ # f.seek(next_shape)
20882092
20892093 return shape
20902094
You can’t perform that action at this time.
0 commit comments