Shapely geometries can be processed into a state that supports more efficient batches of operations.
Shapely几何对象可以被加工成一种 可以支持高效批量操作的形式。
Creates and returns a prepared geometric object.
创建并返回制备几何对象。
To test one polygon containment against a large batch of points, one should first use the prepared.prep()
function.
要检验一个多边形是否包含大批量的点,首先应该使用prepare.prep()函数。
>>> from shapely.prepared import prep
>>> points = [...] # large list of points
>>> polygon = Point(0.0, 0.0).buffer(1.0)
>>> prepared_polygon = prep(polygon)
>>> prepared_polygon
<shapely.prepared.PreparedGeometry object at 0x...>
>>> hits = filter(prepared_polygon.contains, points)
Prepared geometries instances have the following methods: contains
, contains_properly
, covers
, and intersects
. All have exactly the same arguments and usage as their counterparts in non-prepared geometric objects.
制备几何对象实例有以下方法:contains, contains_properly, covers, and intersects。所有这些方法的参数和用法都与非制备几何对象中的对应方法完全相同。