public static GeometryLocation getVertexToSnap ( Geometry g , Point p , double tolerance ) { DistanceOp distanceOp = new DistanceOp ( g , p ) ; GeometryLocation snapedPoint = distanceOp . nearestLocations ( ) [ 0 ] ; if ( tolerance == 0 || snapedPoint . getCoordinate ( ) . distance ( p . getCoordinate ( ) ) <= tolerance ) { return snapedPoint ; } return null ; }
Gets the coordinate of a Geometry that is the nearest of a given Point with a distance tolerance .