Пример #1
0
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)"))
Пример #2
0
 def time_clip_by_box(self):
     shapely.intersection(self.polygon, self.boxes)
Пример #3
0
 def time_intersection(self):
     shapely.intersection(self.points, self.polygon)
Пример #4
0
 def time_intersection_prec2(self):
     shapely.intersection(self.left, self.right, grid_size=2)
Пример #5
0
 def time_intersection(self):
     shapely.intersection(self.left, self.right)
Пример #6
0
 def intersection(self, other):
     """Returns the intersection of the geometries"""
     return shapely.intersection(self, other)