Russell W created SEDONA-96:
-------------------------------

             Summary: ST_MakeValid returning multiple geometries for polygons 
with holes
                 Key: SEDONA-96
                 URL: https://issues.apache.org/jira/browse/SEDONA-96
             Project: Apache Sedona
          Issue Type: Bug
            Reporter: Russell W
         Attachments: Screen Shot 2022-03-29 at 2.17.43 PM.png, Screen Shot 
2022-03-29 at 2.19.37 PM.png

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:
{code:java}
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.select(F.expr('ST_MakeValid(ST_GeomFromGeoJSON(geometry), 
false) AS geometry'))
polygon.createOrReplaceTempView('polygon')
spark.sql('SELECT ST_AsGeoJSON(polygon.geometry) AS geometry FROM polygon')

{"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]]]}
 {code}
Input:

!Screen Shot 2022-03-29 at 2.17.43 PM.png|width=458,height=379!

Output:

!Screen Shot 2022-03-29 at 2.19.37 PM.png|width=457,height=378!



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to