Shapely 1.8.5 中文文档

  1. 主页
  2. 文档
  3. Shapely 1.8.5 中文文档
  4. User Manual
  5. Other Operations(其他操作)
  6. Prepared Geometry Operations(制备几何操作)

Prepared Geometry Operations(制备几何操作)

Shapely geometries can be processed into a state that supports more efficient batches of operations.

Shapely几何对象可以被加工成一种 可以支持高效批量操作的形式。

  • prepared.prep(ob)

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.geometry import Point
>>> 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: containscontains_properlycovers, and intersects. All have exactly the same arguments and usage as their counterparts in non-prepared geometric objects.

制备几何对象实例有以下方法:contains, contains_properly, covers, and intersects。所有这些方法的参数和用法都与非制备几何对象中的对应方法完全相同。

标签 ,
这篇文章对您有用吗?

我们要如何帮助您?

欢迎留下您的宝贵建议

Please enter your comment!
Please enter your name here