Using JTS, how to find the nearest point on a polygon's boundary from an outside point?
Check out the DistanceOp. It returns an array of Coordinates:
Coordinate[] pts = DistanceOp.closestPoints(poly, outsidePoint);
pts[0] will be the point on the first geometry (in this case the polygon) and pts[1] will be on the second geometry (so, the same outside point you just passed in).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With