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
I'm trying to create LinearRing (Polygon) from array of CoordinatesXY but I get exception: IllegalArgumentException: Invalid number of points in LinearRing (found 3 - must be 0 or >= 4)
Why there is a minimum of 4 points? Isn't triangle a valid LinearRing?
Another thing - Java implementation (JTS) requires only 3 points.
LinearRing.MINIMUM_VALID_SIZE=4validateConstruction(){if(!this.isEmpty()&&!super.isClosed.call(this))thrownewIllegalArgumentException('Points of LinearRing do not form a closed linestring')if(this.getCoordinateSequence().size()>=1&&this.getCoordinateSequence().size()<LinearRing.MINIMUM_VALID_SIZE)thrownewIllegalArgumentException('Invalid number of points in LinearRing (found '+this.getCoordinateSequence().size()+' - must be 0 or >= 4)')}
publicclassLinearRingextendsLineString {
publicstaticfinalintMINIMUM_VALID_SIZE = 3;
privatevoidvalidateConstruction() {
if (!isEmpty() && ! super.isClosed()) {
thrownewIllegalArgumentException("Points of LinearRing do not form a closed linestring");
}
if (getCoordinateSequence().size() >= 1 && getCoordinateSequence().size() < MINIMUM_VALID_SIZE) {
thrownewIllegalArgumentException("Invalid number of points in LinearRing (found "
+ getCoordinateSequence().size() + " - must be 0 or >= " + MINIMUM_VALID_SIZE + ")");
}
}
}
Shouldn't this be changed to 3 like in Java code?
The text was updated successfully, but these errors were encountered:
@Ryszard-Trojnacki I guess the definition is that it needs to be a closed ring in which case a triangle would be defined by 4 points. As seen in the pull request in JTS it was lowered with the intent to be able to create invalid rings.
I'm trying to create
LinearRing
(Polygon
) from array ofCoordinatesXY
but I get exception:IllegalArgumentException: Invalid number of points in LinearRing (found 3 - must be 0 or >= 4)
Why there is a minimum of 4 points? Isn't triangle a valid
LinearRing
?Another thing - Java implementation (JTS) requires only 3 points.
JavaScript constant definition and validate method:
Java constant definition and validate method:
Shouldn't this be changed to
3
like in Java code?The text was updated successfully, but these errors were encountered: