Skip to content

Inconsistent bounding box filtering #258

@lgolston

Description

@lgolston

PyShp Version

2.3.1

Python Version

3.11

Your code

import shapefile

fname = "dataverse_files/v6_1820_pref_pts_gbk.shp"
bbox = [19166000, 3461000, 20297000, 3596000]

sf = shapefile.Reader(fname, encoding='gbk')
print(len(list(sf.iterShapeRecords(bbox=bbox))))

Expected results

10

Actual results

301

Other notes

As part of a PR over at cartopy (SciTools/cartopy#2236) I was comparing the output from bounding box spatial filtering with PyShp and fiona for several shapefiles and found some differences. For this shapefile (which just contains Points), PyShp does not seem to filter at all. I think this is a bug? The data used is at https://dataverse.harvard.edu/file.xhtml?persistentId=doi:10.7910/DVN/2K4FHX/V0WEFJ&version=1.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions