You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the Sedona repo, a user reported that they had a geometry for which ST_IsValid was returning true, but an intersection method would throw a non-noded intersection error. See the case from @atiannicelli in this thread: apache/sedona#1612
I have created a minimal reproducible example of a case where I believe isValid is incorrectly returning true below.
defhasSelfIntersections(geom: Geometry) = {
// I only wrote this to consider Polygons and only their external ring// Probably works for Linestrings toovalgeometryFactory=newGeometryFactory()
valcoords= geom.getCoordinates()
valsegments= (0 until coords.length -1).map { i =>valstartPoint= coords(i)
valendPoint= coords(i +1)
geometryFactory.createLineString(Array(startPoint, endPoint))
}
valintersections=for {
i <- segments.indices
j <- i +1 until segments.size // Avoid checking a segment against itselfif (segments(i).intersects(segments(j)))
} yield (segments(i).intersection(segments(j)))
// All intersections are pointsvalintersectionsArePoints= intersections.filter(x => x.getGeometryType !="Point").length ==0// All of those points are the coordinates in the geometry (ie NOT non-noded self-intersections)valintersectionsAreGeomCoords= intersections.map(x => x.getCoordinate).toSet.diff(coords.toSet).size ==0!(intersectionsArePoints && intersectionsAreGeomCoords)
}
The text was updated successfully, but these errors were encountered:
I found a bug in my hasSelfIntersection code. I will close this issue and open one with a higher level Issue I am having with intersecting 2 geometries in JTS.
In the Sedona repo, a user reported that they had a geometry for which ST_IsValid was returning true, but an intersection method would throw a non-noded intersection error. See the case from @atiannicelli in this thread: apache/sedona#1612
I have created a minimal reproducible example of a case where I believe isValid is incorrectly returning true below.
definitions of hasSelfIntersections:
The text was updated successfully, but these errors were encountered: