public static String getLn1TolLn2Direction(LineString ln1, LineString ln2) {
Coordinate sPoint = ln2.getStartPoint().getCoordinate();
Coordinate ePoint = ln2.getEndPoint().getCoordinate();
Coordinate midPoint = new
LengthIndexedLine(lineString).extractPoint(lineString.getLength() / 2D);
if (Orientation.LEFT == Orientation.index(startPoint, endPoint, midPoint)) {
return "left";
} else if (Orientation.RIGHT == Orientation.index(startPoint, endPoint, midPoint)) {
return "right";
} else {
return "";
}
}
判断两个线lineString的相对左右关系
于 2021-12-27 19:07:02 首次发布