Shapely 1.8.5 中文文档

  1. 主页
  2. 文档
  3. Shapely 1.8.5 中文文档
  4. User Manual
  5. Other Operations(其他操作)
  6. Snapping(对齐)

Snapping(对齐)

The snap() function in shapely.ops snaps the vertices in one geometry to the vertices in a second geometry with a given tolerance.

shapely.ops中的snap()函数将一个几何体中的顶点与第二个几何体中的顶点以给定的容差对齐。

  • shapely.ops.snap(geom1geom2tolerance)

Snaps vertices in geom1 to vertices in the geom2. A copy of the snapped geometry is returned. The input geometries are not modified.

将geom1中的顶点与geom2中的顶点对齐。被捕捉的几何体对象副本会被返回。输入的几何对象不会被修改。

The tolerance argument specifies the minimum distance between vertices for them to be snapped.

容差参数指定了执行对齐操作的顶点之间的最小距离。

New in version 1.5.0

>>> from shapely.ops import snap
>>> square = Polygon([(1,1), (2, 1), (2, 2), (1, 2), (1, 1)])
>>> line = LineString([(0,0), (0.8, 0.8), (1.8, 0.95), (2.6, 0.5)])
>>> result = snap(line, square, 0.5)
>>> result.wkt
'LINESTRING (0 0, 1 1, 2 1, 2.6 0.5)'
标签 ,
这篇文章对您有用吗?

我们要如何帮助您?

欢迎留下您的宝贵建议

Please enter your comment!
Please enter your name here