Polygon does not close in Shapely

孤街醉人 提交于 2019-12-02 06:29:28

I think it is related with the third coordinate. In the documentation (shapely doc), it tells:

A third z coordinate value may be used when constructing instances, but has no effect on geometric analysis. All operations are performed in the x-y plane.

This means that shapely simply does not process the z coordinate. In your example, if you erase the z coordinate, you get:

[(620, 420), (620, 420), (620, 40), (620, 40)]
[(620, 40), (620, 420), (620, 420), (620, 40)]

When you pass a linear string to build a polygon, shapely Polygon constructor checks if the last point is equal to the first one. If not, the point is added to get a linear ring. In the second case, as far as shapely can see, the last coordinate is already repeated and there is no need to add any other point.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!