Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
None
Description
When pass a polygon with holes, ST_MakeValid is returning new rows for each hole. This can lead to significant incorrectness when using ST_MakeValid prior to a spatial join.
Example:
polygon = spark.createDataFrame([['{"type": "Polygon", "coordinates": [[[3, 3], [3, -3], [-3, -3], [-3, 3], [3, 3]], [[1, 1], [1, -1], [-1, -1], [-1, 1], [1, 1]]]}']], ['geometry']) polygon = polygon.withColumn('geometry', F.expr('ST_MakeValid(ST_GeomFromGeoJSON(geometry), false)')) polygon = polygon.withColumn('geometry', F.expr('ST_AsGeoJSON(geometry)')) polygon geometry -------------------------------------------------------------------------------------------------------------------------------------------------- {"type":"Polygon","coordinates":[[[3.0,3.0],[3.0,-3.0],[-3.0,-3.0],[-3.0,3.0],[3.0,3.0]],[[1.0,1.0],[-1.0,1.0],[-1.0,-1.0],[1.0,-1.0],[1.0,1.0]]]} {"type":"Polygon","coordinates":[[[-1.0,1.0],[1.0,1.0],[1.0,-1.0],[-1.0,-1.0],[-1.0,1.0]]]}
Input:
Output:
Attachments
Attachments
Issue Links
- links to