After you construct a SparkSession object, you can call the read method to load DataFrames. Ganos Spark provides a set of spatio-temporal operators for you to query spatio-temporal data. Spatio-temporal operators are user-defined functions (UDFs) and can be classified into the following:

1. Spatial Constructors functions

ST_GeomFromGeoHash

Geometry st_geomFromGeoHash(String geohash, Int prec)

Returns a GeoHash value from a given GeoHash code. The prec argument specifies the precision of GeoHash.

ST_GeomFromWKT

Geometry st_geomFromWKT(String wkt)

Constructs a Geometry object from the well-known text (WKT) representation.

ST_GeomFromWKB

Geometry st_geomFromWKB(Array[Byte] wkb)

Constructs a Geometry object from the well-known binary (WKB) representation.

ST_LineFromText

LineString st_lineFromText(String wkt)

Constructs a LineString object from the WKB representation.

ST_MakeBox2D

Geometry st_makeBox2D(Point lowerLeft, Point upperRight)

Constructs a Box2d object defined by lowerLeft and upperRight.

ST_MakeBBOX

Geometry st_makeBBOX(Double lowerX, Double lowerY, Double upperX, Double upperY)

Constructs a bounding box (BBOX) object defined by the given boundary coordinates.

ST_MakePolygon

Polygon st_makePolygon(LineString shell)

Constructs a Polygon object defined by a given shell. The input shell must be a closed LineString.

ST_MakePoint

Point st_makePoint(Double x, Double y)

Constructs a Point object defined by the given X-coordinate and Y-coordinate.

ST_MakeLine

LineString st_makeLine(Seq[Point] points)

Constructs a LineString object defined by the given Point objects.

ST_MakePointM

Point st_makePointM(Double x, Double y, Double m)

Constructs a Point object defined by the given X-coordinate, Y-coordinate, and M-coordinate.

ST_MLineFromText

MultiLineString st_mLineFromText(String wkt)

Constructs a MultiLineString object defined by the given WKT representation.

ST_MPointFromText

MultiPoint st_mPointFromText(String wkt)

Constructs a MultiPoint object defined by the given WKT representation.

ST_MPolyFromText

MultiPolygon st_mPolyFromText(String wkt)

Constructs a MultiPolygon object defined by the given WKT representation.

ST_Point

Point st_point(Double x, Double y)

Constructs a Point object defined by the given X-coordinate and Y-coordinate. This function is similar to ST_MakePoint.

ST_PointFromGeoHash

Point st_pointFromGeoHash(String geohash, Int prec)

Return the Point at the geometric center of the bounding box defined by the GeoHash (base-32 encoded). The prec argument specifies the precision of GeoHash.

ST_PointFromText

Point st_pointFromText(String wkt)

ST_PointFromWKB

Point st_pointFromWKB(Array[Byte] wkb)

Constructs a Point object from the given WKB representation.

ST_Polygon

Polygon st_polygon(LineString shell)

Constructs a Polygon object from a given LineString.

ST_PolygonFromText

Polygon st_polygonFromText(String wkt)

Constructs a Polygon object from the given WKT representation.

2. Geometry Accessors functions

ST_Boundary

Geometry st_boundary(Geometry geom)

Returns the boundary of a ST_Geometry.

ST_CoordDim

Int st_coordDim(Geometry geom)

Returns the number of dimensions of the coordinates of a Geometry object. To query the dimension of a geometry, use the ST_Dimension function.

ST_Dimension

Int st_dimension(Geometry geom)

Returns the inherent number of dimensions of a Geometry object.

ST_Envelope

Geometry st_envelope(Geometry geom)

Returns the BBOX of a ST_Geometry value.

ST_ExteriorRing

LineString st_exteriorRing(Geometry geom)

Returns a LineString representing the exterior ring of a given Polygon geometry.

ST_GeometryN

Int st_geometryN(Geometry geom, Int n)

http://desktop.arcgis.com/zh-cn/arcmap/10.3/manage-data/using-sql-with-gdbs/st-geometryn.htmReturns the Nth geometry within a Geometry object. N is a given value. For example, if you want to return the second point within a MultiPoint object, set the value of N to 2.

ST_InteriorRingN

Int st_interiorRingN(Geometry geom, Int n)

Returns a LineString representing the Nth interior ring of a given Polygon geometry.

ST_IsClosed

Boolean st_isClosed(Geometry geom)

Returns a value that indicates whether a LineString is closed. TRUE is returned if a LineString is closed.

ST_IsCollection

Boolean st_isCollection(Geometry geom)

Returns a value that indicates whether a geometry is a collection.

ST_IsEmpty

Boolean st_isEmpty(Geometry geom)

Returns a value that indicates whether a geometry is empty. This function is used to verify a ST_Geometry. Value 1 (TRUE) is returned if the geometry is empty and value 0 (FALSE) is returned if it is not empty.

ST_IsRing

Boolean st_isRing(Geometry geom)

Returns a value that indicates whether a given ST_LineString is a ring. Value 1 is returned if the ST_LineString is a ring and value 0 is returned if it is not a ring.

ST_IsSimple

Boolean st_isSimple(Geometry geom)

Returns a value that indicates whether a given ST_LineString, ST_MultiPoint, or ST_MultiLineString is simple.

ST_IsValid

Boolean st_isValid(Geometry geom)

Returns a value that indicates whether a given geometry collection is valid.

ST_NumGeometries

Int st_numGeometries(Geometry geom)

Returns the number of geometries of a given type in a geometry collection, such as the number of ST_MultiPoint, ST_MultiLineString, or ST_MultiPolygon geometries.

ST_NumPoints

Int st_numPoints(Geometry geom)

Returns the number of points in a given ST_LineString.

ST_PointN

Point st_pointN(Geometry geom, Int n)

Returns the Nth point in a given ST_LineString.

ST_X

Float st_X(Geometry geom)

Returns a double-precision digit that indicates the X-coordinate of a point.

ST_Y

Float st_y(Geometry geom)

Returns a double-precision digit that indicates the Y-coordinate of a point.

3. Geometry Cast functions

ST_CastToPoint

Point st_castToPoint(Geometry g)

Casts a Geometry to a Point.

ST_CastToPolygon

Polygon st_castToPolygon(Geometry g)

Casts a Geometry to a Polygon.

ST_CastToLineString

LineString st_castToLineString(Geometry g)

Casts a Geometry to a LineString.

ST_ByteArray

Array[Byte] st_byteArray(String s)

Casts a String to a Byte Array by using UTF-8 encoding.

4. Geometry Editors functions

ST_Translate

Geometry st_translate(Geometry geom, Double deltaX, Double deltaY)

Returns a new geometry whose coordinates are translated from deltaX and deltaY.

5. Geometry Outputs functions

ST_AsBinary

Array[Byte] st_asBinary(Geometry geom)

Returns the Byte Array representation of a Geometry.

ST_AsGeoJSON

String st_asGeoJSON(Geometry geom)

Returns the GeoJSON representation of a Geometry.

ST_AsLatLonText

String st_asLatLonText(Point p)

Returns the Degrees, Minutes, and Seconds representation of a Point. It assumes that the point is in a latitude/longitude projection.

ST_AsText

String st_asText(Geometry geom)

Returns the well-known text (WKT) representation of a Geometry.

ST_GeoHash

String st_geoHash(Geometry geom, Int prec)

Returns the GeoHash representation of a Geometry. The prec argument specifies the precision.

6. Spatial Relationships functions

ST_Contains

Boolean st_contains(Geometry a, Geometry b)

Returns true if and only if no points of Geometry B lie in the exterior of Geometry A, and at least one point of the interior of Geometry B lies in the interior of Geometry A.

ST_Covers

Boolean st_covers(Geometry a, Geometry b)

Returns true if no point in Geometry B is outside Geometry A.

ST_Crosses

Boolean st_crosses(Geometry a, Geometry b)

Returns true if Geometry A and Geometry B are partially intersected. This means that the geometries have some, but not all interior points in common.

ST_Disjoint

Boolean st_disjoint(Geometry a, Geometry b)

Returns true if Geometry A and Geometry B are disjoint. This function is equivalent to NOT ST_Intersects.

ST_Equals

Boolean st_equals(Geometry a, Geometry b)

Returns true if Geometry A and Geometry B are spatially equal.

ST_Intersects

Boolean st_intersects(Geometry a, Geometry b)

Returns true if Geometry A and Geometry B share any portion of the space (intersected).

ST_Overlaps

Boolean st_overlaps(Geometry a, Geometry b)

Returns true if Geometry A and Geometry B spatially overlap. This means that they are equal in size, and the intersection point and the geometries are equal in size.

ST_Touches

Boolean st_touches(Geometry a, Geometry b)

Returns true if Geometry A and Geometry B have at lease one point in common, but they do not have any interior intersection.

ST_Within

Boolean st_within(Geometry a, Geometry b)

Returns true if Geometry A completely lies in the interior of Geometry B.

ST_Relate

String st_relate(Geometry a, Geometry b)

Returns the DE-9IM matrix pattern that shows the dimension of intersections between the Interior, Boundary, and Exterior of two geometries.

ST_RelateBool

Boolean st_relateBool(Geometry a, Geometry b, String mask)

Returns true if the mask of the DE-9IM matrix pattern matches that of the DE-9IM matrix pattern returned by st_relate(a, b).

ST_Area

Double st_area(Geometry g)

Returns the area of a Geometry.

ST_Centroid

Point st_centroid(Geometry g)

Returns the geometric center of a Geometry.

ST_ClosestPoint

Point st_closestPoint(Geometry a, Geometry b)

Returns the point on Geometry A that is closest to Geometry B.

ST_Distance

Double st_distance(Geometry a, Geometry b)

Returns the 2-dimensional Cartesian distance between two geometries in projected units, such as EPSG:4236.

ST_DistanceSphere

Double st_distanceSphere(Geometry a, Geometry b)

Returns the minimum distance between two longitude/latitude geometries. It assumes a spherical earth.

ST_Length

Double st_length(Geometry geom)

Returns the 2-dimensional length of a Line geometry or the perimeter of a Plane geometry, such as EPSG:4236. The units are determined by the spatial reference system of the geometry. It returns 0.0 for other types of geometries, such as Point.

ST_LengthSphere

Double st_lengthSphere(LineString line)

Returns the approximate 2-dimensional length of a LineString. It assumes a spherical earth. The returned length is measured in meters. The approximation is within 0.3% of st_lengthSpheroid and this function is more efficient in computation.

7. Geometry Processing functions

ST_antimeridianSafeGeom

Geometry st_antimeridianSafeGeom(Geometry geom)

Attempts to convert the geometry into an equivalent form of "antimeridian-safe" if the geometry spans the antimeridian. For example, the output geometry is covered by BOX (-180 -90, 180 90). In some cases, this method may fail, and the input geometry will be returned and then an error will be logged.

ST_BufferPoint

Geometry st_bufferPoint(Point p, Double buffer)

Returns a geometry covering all points within a given radius of Point p. The radius is measured in meters.

ST_ConvexHull

Geometry st_convexHull(Geometry geom)

An aggregate function. The convex hull of a geometry represents the minimum convex geometry that encloses all geometries in the aggregated rows.