Files
geopandas/benchmarks/clip.py
T
Adrian Garcia Badaracco e0eaf813e7 ENH: Implement sindex query in clip (#1427)
* Implement query in clip

* cleanup

* add benchmarks
2020-05-15 18:52:05 +01:00

15 lines
460 B
Python

from geopandas import read_file, datasets, clip
from shapely.geometry import box
class Bench:
def setup(self, *args):
world = read_file(datasets.get_path("naturalearth_lowres"))
capitals = read_file(datasets.get_path("naturalearth_cities"))
self.bounds = [box(*geom.bounds) for geom in world.geometry]
self.points = capitals
def time_clip(self):
for bound in self.bounds:
clip(self.points, bound)