public static Geometry getFurthestCoordinate(Point point, Geometry geom) {
        if (point == null || geom == null) {
            return null;
        }
        double minDistance = Double.POSITIVE_INFINITY;
        Coordinate pointCoordinate = point.getCoordinate();
        Set<Coordinate> closestCoordinates = new HashSet<Coordinate>();
        for (Coordinate c : geom.getCoordinates()) {
            double distance = c.distance(pointCoordinate);
            if (Double.compare(distance, minDistance) == 0) {
                closestCoordinates.add(c);
            }
            if (Double.compare(distance, minDistance) < 0) {
                minDistance = distance;
                closestCoordinates.clear();
                closestCoordinates.add(c);
            }
        }
        if (closestCoordinates.size() == 1) {
            return GEOMETRY_FACTORY.createPoint(closestCoordinates.iterator().next());
        }
        return GEOMETRY_FACTORY.createMultiPoint(
                closestCoordinates.toArray(new Coordinate[0]));
    }
public static Geometry getFurthestCoordinate ( Point point , Geometry geom ) { if ( point == null || geom == null ) { return null ; } double minDistance = Double . POSITIVE_INFINITY ; Coordinate pointCoordinate = point . getCoordinate ( ) ; Set < Coordinate > closestCoordinates = new HashSet < Coordinate > ( ) ; for ( Coordinate c : geom . getCoordinates ( ) ) { double distance = c . distance ( pointCoordinate ) ; if ( Double . compare ( distance , minDistance ) == 0 ) { closestCoordinates . add ( c ) ; } if ( Double . compare ( distance , minDistance ) < 0 ) { minDistance = distance ; closestCoordinates . clear ( ) ; closestCoordinates . add ( c ) ; } } if ( closestCoordinates . size ( ) == 1 ) { return GEOMETRY_FACTORY . createPoint ( closestCoordinates . iterator ( ) . next ( ) ) ; } return GEOMETRY_FACTORY . createMultiPoint ( closestCoordinates . toArray ( new Coordinate [ 0 ] ) ) ; }
Computes the closest coordinate(s) contained in the given geometry starting
from the given point, using the 2D distance.

@param point Point
@param geom  Geometry
@return The closest coordinate(s) contained in the given geometry starting from
the given point, using the 2D distance