Java Code Examples for com.esri.core.geometry.ogc.OGCGeometry#distance()

The following examples show how to use com.esri.core.geometry.ogc.OGCGeometry#distance() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
 * Perform a real join based on the geometry of the data
public boolean filterJoinCandidate(final Tuple tuple1, final Tuple tuple2, final byte[] customData) {
	final String geoJsonString1 = new String(tuple1.getDataBytes());
	final String geoJsonString2 = new String(tuple2.getDataBytes());

	// Full text search on string (if provided)
	if(customData != null) {
		final String customDataString = new String(customData);
		if(! geoJsonString1.contains(customDataString) && 
				! geoJsonString2.contains(customDataString)) {
			return false;
	final OGCGeometry geometry1 = extractGeometry(geoJsonString1);
	final OGCGeometry geometry2 = extractGeometry(geoJsonString2);
	if(geometry1 instanceof OGCPoint) {
		final double geometryDistrance = geometry1.distance(geometry2);
		return geometryDistrance < MAX_OVERLAPPING_POINT_DISTANCE;
	} else {
	    return geometry1.intersects(geometry2);
Example 2
Source Project: presto   File:    License: Apache License 2.0 5 votes vote down vote up
@Description("Returns the 2-dimensional cartesian minimum distance (based on spatial ref) between two geometries in projected units")
public static Double stDistance(@SqlType(GEOMETRY_TYPE_NAME) Slice left, @SqlType(GEOMETRY_TYPE_NAME) Slice right)
    OGCGeometry leftGeometry = deserialize(left);
    OGCGeometry rightGeometry = deserialize(right);
    verifySameSpatialReference(leftGeometry, rightGeometry);
    return leftGeometry.isEmpty() || rightGeometry.isEmpty() ? null : leftGeometry.distance(rightGeometry);