use of io.prestosql.spi.function.ScalarFunction in project hetu-core by openlookeng.
the class GeoFunctions method stPolygon.
@Description("Returns a Geometry type Polygon object from Well-Known Text representation (WKT)")
@ScalarFunction("ST_Polygon")
@SqlType(GEOMETRY_TYPE_NAME)
public static Slice stPolygon(@SqlType(VARCHAR) Slice input) {
OGCGeometry geometry = geometryFromText(input);
validateType("ST_Polygon", geometry, EnumSet.of(POLYGON));
return serialize(geometry);
}
use of io.prestosql.spi.function.ScalarFunction 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