def test_set_precision_intersection(): """Operations should use the most precise presision grid size of the inputs""" box1 = shapely.normalize(shapely.box(0, 0, 0.9, 0.9)) box2 = shapely.normalize(shapely.box(0.75, 0, 1.75, 0.75)) assert shapely.get_precision(shapely.intersection(box1, box2)) == 0 # GEOS will use and keep the most precise precision grid size box1 = shapely.set_precision(box1, 0.5) box2 = shapely.set_precision(box2, 1) out = shapely.intersection(box1, box2) assert shapely.get_precision(out) == 0.5 assert_geometries_equal(out, shapely.Geometry("LINESTRING (1 1, 1 0)"))
def time_clip_by_box(self): shapely.intersection(self.polygon, self.boxes)
def time_intersection(self): shapely.intersection(self.points, self.polygon)
def time_intersection_prec2(self): shapely.intersection(self.left, self.right, grid_size=2)
def time_intersection(self): shapely.intersection(self.left, self.right)
def intersection(self, other): """Returns the intersection of the geometries""" return shapely.intersection(self, other)