Skip to content

Commit 408c7d1

Browse files
committed
Don't overwrite user specified bbox with the one read from shp file
1 parent b7302b6 commit 408c7d1

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/shapefile.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -845,8 +845,8 @@ def __repr__(self):
845845
return f"Shape #{self.__oid}: {self.shapeTypeName}"
846846

847847
# pylint: disable=unused-argument
848-
def _get_and_set_bbox_from_shp_file(self, f):
849-
return None
848+
def _set_bbox_from_shp_file(self, f):
849+
pass
850850

851851
@staticmethod
852852
def _get_nparts_from_shp_file(f):
@@ -886,7 +886,7 @@ def _set_single_point_m_from_shp_file(self, f, next_shape):
886886
def _from_shp_file(cls, f, next_shape, oid=None, bbox=None):
887887
shape = cls(oid=oid)
888888

889-
bbox = shape._get_and_set_bbox_from_shp_file(f) # pylint: disable=assignment-from-none
889+
shape._set_bbox_from_shp_file(f) # pylint: disable=assignment-from-none
890890

891891
# if bbox specified and no overlap, skip this shape
892892
if bbox is not None and not bbox_overlap(bbox, tuple(shape.bbox)): # pylint: disable=no-member
@@ -962,10 +962,9 @@ class _CanHaveBBox(Shape):
962962
# Not a BBox because the legacy implementation was a list, not a 4-tuple.
963963
bbox: Optional[Sequence[float]] = None
964964

965-
def _get_and_set_bbox_from_shp_file(self, f):
965+
def _set_bbox_from_shp_file(self, f):
966966
# record.bbox = tuple(_Array[float]("d", unpack("<4d", f.read(32))))
967967
self.bbox = _Array[float]("d", unpack("<4d", f.read(32)))
968-
return self.bbox
969968

970969
@staticmethod
971970
def _get_npoints_from_shp_file(f):

0 commit comments

Comments
 (0)