use of io.prestosql.spi.function.SqlNullable in project hetu-core by openlookeng.
the class GeoFunctions method stOverlaps.
@SqlNullable
@Description("Returns TRUE if the Geometries share space, are of the same dimension, but are not completely contained by each other")
@ScalarFunction("ST_Overlaps")
@SqlType(BOOLEAN)
public static Boolean stOverlaps(@SqlType(GEOMETRY_TYPE_NAME) Slice left, @SqlType(GEOMETRY_TYPE_NAME) Slice right) {
if (!envelopes(left, right, Envelope::intersect)) {
return false;
}
OGCGeometry leftGeometry = deserialize(left);
OGCGeometry rightGeometry = deserialize(right);
verifySameSpatialReference(leftGeometry, rightGeometry);
return leftGeometry.overlaps(rightGeometry);
}
use of io.prestosql.spi.function.SqlNullable in project hetu-core by openlookeng.
the class GeoFunctions method stEndPoint.
@SqlNullable
@Description("Returns the last point of a LINESTRING geometry as a Point")
@ScalarFunction("ST_EndPoint")
@SqlType(GEOMETRY_TYPE_NAME)
public static Slice stEndPoint(@SqlType(GEOMETRY_TYPE_NAME) Slice input) {
OGCGeometry geometry = deserialize(input);
validateType("ST_EndPoint", geometry, EnumSet.of(LINE_STRING));
if (geometry.isEmpty()) {
return null;
}
MultiPath lines = (MultiPath) geometry.getEsriGeometry();
SpatialReference reference = geometry.getEsriSpatialReference();
return serialize(createFromEsriGeometry(lines.getPoint(lines.getPointCount() - 1), reference));
}
Aggregations