public void eval() { com.esri.core.geometry.ogc.OGCGeometry geom1; com.esri.core.geometry.ogc.OGCGeometry geom2; geom1 = com.esri.core.geometry.ogc.OGCGeometry .fromBinary(geom1Param.buffer.nioBuffer(geom1Param.start, geom1Param.end - geom1Param.start)); geom2 = com.esri.core.geometry.ogc.OGCGeometry .fromBinary(geom2Param.buffer.nioBuffer(geom2Param.start, geom2Param.end - geom2Param.start)); out.value = geom1.distance(geom2); } }
public void eval() { double distance = distanceParam.value; com.esri.core.geometry.ogc.OGCGeometry geom1; com.esri.core.geometry.ogc.OGCGeometry geom2; geom1 = com.esri.core.geometry.ogc.OGCGeometry .fromBinary(geom1Param.buffer.nioBuffer(geom1Param.start, geom1Param.end - geom1Param.start)); geom2 = com.esri.core.geometry.ogc.OGCGeometry .fromBinary(geom2Param.buffer.nioBuffer(geom2Param.start, geom2Param.end - geom2Param.start)); out.value = geom1.distance(geom2) <= distance ? 1 : 0; } }
@SqlNullable @Description("Returns the 2-dimensional cartesian minimum distance (based on spatial ref) between two geometries in projected units") @ScalarFunction("ST_Distance") @SqlType(DOUBLE) 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); }
.pageBreak() .row(stPoint(10, 0), "10_0", 1.5); PagesSpatialIndexFactory pagesSpatialIndexFactory = buildIndex(driverContext, (build, probe, r) -> build.distance(probe) <= r.getAsDouble(), Optional.of(2), Optional.empty(), buildPages);
@Override protected Object evaluateOGCGeometry(OGCGeometry geometry0, OGCGeometry geometry1) throws HyracksDataException { return geometry0.distance(geometry1); }
@Override public double distance(OGCGeometry another) { if (this == another) return isEmpty() ? Double.NaN : 0; double minD = Double.NaN; for (int i = 0, n = numGeometries(); i < n; ++i) { // TODO Skip expensive distance computation if bounding boxes are further away than minD double d = geometryN(i).distance(another); if (d < minD || Double.isNaN(minD)) { minD = d; // TODO Replace zero with tolerance defined by the spatial reference if (minD == 0) { break; } } } return minD; }
@Override public double distance(OGCGeometry another) { if (this == another) return isEmpty() ? Double.NaN : 0; double minD = Double.NaN; for (int i = 0, n = numGeometries(); i < n; ++i) { // TODO Skip expensive distance computation if bounding boxes are further away than minD double d = geometryN(i).distance(another); if (d < minD || Double.isNaN(minD)) { minD = d; // TODO Replace zero with tolerance defined by the spatial reference if (minD == 0) { break; } } } return minD; }
@Override public double distanceTo(double x, double y) { OGCPoint point = new OGCPoint(new com.esri.core.geometry.Point(x, y), this.geom.getEsriSpatialReference()); return this.geom.distance(point); }
public double distance(OGCGeometry another) { if (this == another) { return isEmpty() ? Double.NaN : 0; } if (another.geometryType() == OGCConcreteGeometryCollection.TYPE) { return another.distance(this); } com.esri.core.geometry.Geometry geom1 = getEsriGeometry(); com.esri.core.geometry.Geometry geom2 = another.getEsriGeometry(); return com.esri.core.geometry.GeometryEngine.distance(geom1, geom2, getEsriSpatialReference()); }
public double distance(OGCGeometry another) { if (this == another) { return isEmpty() ? Double.NaN : 0; } if (another.geometryType() == OGCConcreteGeometryCollection.TYPE) { return another.distance(this); } com.esri.core.geometry.Geometry geom1 = getEsriGeometry(); com.esri.core.geometry.Geometry geom2 = another.getEsriGeometry(); return com.esri.core.geometry.GeometryEngine.distance(geom1, geom2, getEsriSpatialReference()); }
@SqlNullable @Description("Returns the 2-dimensional cartesian minimum distance (based on spatial ref) between two geometries in projected units") @ScalarFunction("ST_Distance") @SqlType(DOUBLE) 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); }
@SqlNullable @Description("Returns the 2-dimensional cartesian minimum distance (based on spatial ref) between two geometries in projected units") @ScalarFunction("ST_Distance") @SqlType(DOUBLE) 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); }
public DoubleWritable evaluate(BytesWritable geometryref1, BytesWritable geometryref2) { if (geometryref1 == null || geometryref2 == null || geometryref1.getLength() == 0 || geometryref2.getLength() == 0) { LogUtils.Log_ArgumentsNull(LOG); return null; } if (!GeometryUtils.compareSpatialReferences(geometryref1, geometryref2)) { LogUtils.Log_SRIDMismatch(LOG, geometryref1, geometryref2); return null; } OGCGeometry ogcGeom1 = GeometryUtils.geometryFromEsriShape(geometryref1); OGCGeometry ogcGeom2 = GeometryUtils.geometryFromEsriShape(geometryref2); if (ogcGeom1 == null || ogcGeom2 == null){ LogUtils.Log_ArgumentsNull(LOG); return null; } try { resultDouble.set(ogcGeom1.distance(ogcGeom2)); return resultDouble; } catch (Exception e) { LogUtils.Log_InternalError(LOG, "ST_Distance: " + e); return null; } } }
.pageBreak() .row(stPoint(10, 0), "10_0", 1.5); PagesSpatialIndexFactory pagesSpatialIndexFactory = buildIndex(driverContext, (build, probe, r) -> build.distance(probe) <= r.getAsDouble(), Optional.of(2), Optional.empty(), buildPages);
.pageBreak() .row(stPoint(10, 0), "10_0", 1.5); PagesSpatialIndexFactory pagesSpatialIndexFactory = buildIndex(driverContext, (build, probe, r) -> build.distance(probe) <= r.getAsDouble(), Optional.of(2), Optional.empty(), buildPages);