在Postgis中有两个非常相似的函数。一是st_isValid ,另一个是st_isSimple 。我想了解多边形两者之间的区别。对于 st_isValid 我们有:
Some of the rules of polygon validity feel obvious, and others feel arbitrary (and in fact, are arbitrary).
- Polygon rings must close.
- Rings that define holes should be inside rings that define exterior boundaries.
- Rings may not self-intersect (they may neither touch nor cross one another).
- Rings may not touch other rings, except at a point.
对于 st_isSimple,我们有:
Returns true if this Geometry has no anomalous geometric points, such as self intersection or self tangency. For more information on the OGC's definition of geometry simplicity and validity, refer to "Ensuring OpenGIS compliancy of geometries"
这是否意味着任何有效的多边形都自动是简单的?
最佳答案
这两个函数都会检查几何图形的相似 OGC 定义合规性,但是为不同的几何图形定义(按维度);
根据 OGC 定义
一个
[Multi]LineString
可以(应该)简单一个
[Multi]Polygon
可以(应该)有效
这意味着
一个简单
[Multi]LineString
始终被视为有效有效
[Multi]Polygon
总是被认为是简单的(例如,它必须至少有一个简单封闭的LineString
环)
因此答案是肯定的。
严格来说,对“错误”几何类型使用 OGC 定义功能的固有检查是没有用的。
PostGIS 然而,自由地扩展了 ST_IsValid
的功能。对所有几何类型使用正确的检查。
关于geometry - st_isvalid 和 st_issimple 有什么区别?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58586973/