Skip to content

Commit 68a7a47

Browse files
committed
add bbox None check
1 parent 9d31036 commit 68a7a47

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

shapefile.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1360,12 +1360,13 @@ def __shape(self, oid=None, bbox=None):
13601360
# Read a single point
13611361
if shapeType in (1,11,21):
13621362
record.points = [_Array('d', unpack("<2d", f.read(16)))]
1363-
# create bounding box for Point by duplicating coordinates
1364-
point_bbox = list(record.points[0] + record.points[0])
1365-
# skip shape if no overlap with bounding box
1366-
if not bbox_overlap(bbox, point_bbox):
1367-
f.seek(next)
1368-
return None
1363+
if bbox is not None:
1364+
# create bounding box for Point by duplicating coordinates
1365+
point_bbox = list(record.points[0] + record.points[0])
1366+
# skip shape if no overlap with bounding box
1367+
if not bbox_overlap(bbox, point_bbox):
1368+
f.seek(next)
1369+
return None
13691370
# Read a single Z value
13701371
if shapeType == 11:
13711372
record.z = list(unpack("<d", f.read(8)))

0 commit comments

Comments
 (0)