11.6. SparkSQL函数¶
下面是由定义的空间SparkSQL用户定义函数的列表 geomesa-spark-sql
模块。
11.6.1. 几何构造器¶
11.6.1.1. st_box2DFromGeoHash¶
Geometry st_box2DFromGeoHash(String geohash, Int prec)
的别名 st_geomFromGeoHash 。
11.6.1.2. st_geomFromGeoHash¶
Geometry st_geomFromGeoHash(String geohash, Int prec)
返回 Geometry
与Geohash字符串对应的边界框的 geohash (32进制编码),精度为 prec 比特。看见 Geohash 有关GeoHash的更多信息。
11.6.1.3. st_geomFromGeoJSON¶
Geometry st_geomFromGeoJSON(String geojsonGeometry)
从给定的GeoJSON几何创建几何 (GeoJson) 。
11.6.1.4. st_geomFromText¶
Geometry st_geomFromText(String wkt)
的别名 st_geomFromWKT 。
11.6.1.5. st_geomFromWKB¶
Geometry st_geomFromWKB(Array[Byte] wkb)
创建一个 Geometry
从给定的熟知的二进制表示 (WKB) 。
11.6.1.6. st_geomFromWKT¶
Geometry st_geomFromWKT(String wkt)
根据给定的熟知文本表示创建几何 (WKT) 。
11.6.1.7. st_geometryFromText¶
Geometry st_geometryFromText(String wkt)
的别名 st_geomFromWKT
11.6.1.8. st_lineFromText¶
LineString st_lineFromText(String wkt)
创建一个 LineString
从给定的 WKT 代表权。
11.6.1.9. st_mLineFromText¶
MultiLineString st_mLineFromText(String wkt)
创建一个 MultiLineString
对应于给定的 WKT 代表权。
11.6.1.10. st_mPointFromText¶
MultiPoint st_mPointFromText(String wkt)
创建一个 MultiPoint
对应于给定的 WKT 代表权。
11.6.1.11. st_mPolyFromText¶
MultiPolygon st_mPolyFromText(String wkt)
创建一个 MultiPolygon
对应于给定的 WKT 代表权。
11.6.1.12. st_makeBBOX¶
Geometry st_makeBBOX(Double lowerX, Double lowerY, Double upperX, Double upperY)
创建一个 Geometry
表示具有给定边界的边框。
11.6.1.13. st_makeBox2D¶
Geometry st_makeBox2D(Point lowerLeft, Point upperRight)
创建一个 Geometry
属性定义的边框。 Point
S。
11.6.1.14. st_makeLine¶
LineString st_makeLine(Seq[Point] points)
创建一个 LineString
在中使用给定的顶点序列 points 。
11.6.1.15. st_makePoint¶
Point st_makePoint(Double x, Double y)
创建一个 Point
vbl.用一种. x 和 y 协调。
11.6.1.16. st_makePointM¶
Point st_makePointM(Double x, Double y, Double m)
创建一个 Point
vbl.用一种. x , y ,以及 m 协调。
11.6.1.17. st_makePolygon¶
Polygon st_makePolygon(LineString shell)
Creates a Polygon
formed by the given LineString
shell, which must be closed.
11.6.1.18. st_point¶
Point st_point(Double x, Double y)
返回一个 Point
具有给定的坐标值。这是的OGC别名 st_makePoint 。
11.6.1.19. st_pointFromGeoHash¶
Point st_pointFromGeoHash(String geohash, Int prec)
返回 Point
在由Geohash字符串定义的边界框的几何中心 geohash (32进制编码),精度为 prec 比特。看见 Geohash 有关Geohash的更多信息。
11.6.1.20. st_pointFromText¶
Point st_pointFromText(String wkt)
创建一个 Point
对应于给定的 WKT 代表权。
11.6.1.21. st_pointFromWKB¶
Point st_pointFromWKB(Array[Byte] wkb)
创建一个 Point
对应于给定的 WKB 代表权。
11.6.1.22. st_polygon¶
Polygon st_polygon(LineString shell)
Creates a Polygon
formed by the given LineString
shell, which must be closed.
11.6.1.23. st_polygonFromText¶
Polygon st_polygonFromText(String wkt)
创建一个 Polygon
对应于给定的 WKT 代表权。
11.6.2. 几何体访问器¶
11.6.2.1. st_boundary¶
Geometry st_boundary(Geometry geom)
如果为,则返回边界或相应尺寸的空几何图形 geom 是空的。
11.6.2.2. st_coordDim¶
Int st_coordDim(Geometry geom)
Returns the number of dimensions of the coordinates of Geometry
geom.
11.6.2.3. st_dimension¶
Int st_dimension(Geometry geom)
对象的固有维度数。 Geometry
对象,它必须小于或等于坐标维度。
11.6.2.4. st_envelope¶
Geometry st_envelope(Geometry geom)
返回一个 Geometry
的边框,表示 geom 。
11.6.2.5. st_exteriorRing¶
LineString st_exteriorRing(Geometry geom)
返回一个 LineString
表示几何体的外环;如果 Geometry
不是一个 Polygon
。
11.6.2.6. st_geometryN¶
Int st_geometryN(Geometry geom, Int n)
返回 n - Geometry
(以1为基础的指数) geom 如果 Geometry
是一种 GeometryCollection
,或 geom 如果不是的话。
11.6.2.7. st_interiorRingN¶
Int st_interiorRingN(Geometry geom, Int n)
Returns the n-th interior LineString
ring of the Polygon
geom. Returns null if the geometry is not
a Polygon
or the given n is out of range.
11.6.2.8. st_isClosed¶
Boolean st_isClosed(Geometry geom)
如果满足以下条件,则返回True geom 是一种 LineString
或 MultiLineString
它的起点和终点是重合的。对于所有其他类型,返回True Geometry
类型。
11.6.2.9. st_isCollection¶
Boolean st_isCollection(Geometry geom)
如果满足以下条件,则返回True geom 是一种 GeometryCollection
。
11.6.2.10. st_isEmpty¶
Boolean st_isEmpty(Geometry geom)
如果满足以下条件,则返回True geom 是空的。
11.6.2.11. st_isRing¶
Boolean st_isRing(Geometry geom)
如果满足以下条件,则返回True geom 是一种 LineString
或者是 MultiLineString
既封闭又简单。
11.6.2.12. st_isSimple¶
Boolean st_isSimple(Geometry geom)
如果满足以下条件,则返回True geom 没有反常的几何点,例如自交或自切。
11.6.2.13. st_isValid¶
Boolean st_isValid(Geometry geom)
如果返回True,则 Geometry
根据OGC SFS规范在拓扑上是有效的。
11.6.2.14. st_numGeometries¶
Int st_numGeometries(Geometry geom)
如果 geom 是一种 GeometryCollection
,返回几何图形的数量。对于单个几何图形,返回1,
11.6.2.15. st_numPoints¶
Int st_numPoints(Geometry geom)
Returns the number of vertices in Geometry
geom.
11.6.2.16. st_pointN¶
Point st_pointN(Geometry geom, Int n)
如果 geom 是一种 LineString
,则返回 n -第3个顶点 geom 作为一个点。的末尾开始向后计数负值。 LineString
。如果满足以下条件,则返回NULL geom 不是一个 LineString
。
11.6.2.17. st_x¶
Float st_X(Geometry geom)
如果 geom 是一种 Point
,则返回该点的X坐标。
11.6.2.18. st_y¶
Float st_y(Geometry geom)
如果 geom 是一种 Point
,则返回该点的Y坐标。
11.6.3. 几何体投射¶
11.6.3.1. st_castToLineString¶
LineString st_castToLineString(Geometry g)
Casts Geometry
g to a LineString
.
11.6.3.2. st_castToPoint¶
Point st_castToPoint(Geometry g)
Casts Geometry
g to a Point
.
11.6.3.3. st_castToPolygon¶
Polygon st_castToPolygon(Geometry g)
Casts Geometry
g to a Polygon
.
11.6.3.4. st_castToGeometry¶
Geometry st_castToGeometry(Geometry g)
投射 Geometry
子类 g 到一个 Geometry
。这可能是必要的,例如,当存储 st_makePoint
作为一名 Geometry
在一堂案例课上。
11.6.3.5. st_byteArray¶
Array[Byte] st_byteArray(String s)
对字符串进行编码 s 转换为使用UTF-8字符集的字节数组。
11.6.4. 几何图形编辑器¶
11.6.4.1. st_translate¶
Geometry st_translate(Geometry geom, Double deltaX, Double deltaY)
返回 Geometry
在以下时间生成 geom 由以下人员翻译 deltaX 和 deltaY 。
11.6.5. 几何体输出¶
11.6.5.1. st_asBinary¶
Array[Byte] st_asBinary(Geometry geom)
Returns Geometry
geom in WKB representation.
11.6.5.2. st_asGeoJSON¶
String st_asGeoJSON(Geometry geom)
Returns Geometry
geom in GeoJSON representation.
11.6.5.3. st_asLatLonText¶
String st_asLatLonText(Point p)
Returns a String
describing the latitude and longitude of Point
p in degrees, minutes, and seconds.
(This presumes that the units of the coordinates of p are latitude and longitude.)
11.6.5.4. st_asText¶
String st_asText(Geometry geom)
Returns Geometry
geom in WKT representation.
11.6.5.5. st_geoHash¶
String st_geoHash(Geometry geom, Int prec)
返回几何内点的Geohash(以32进制表示) geom 。看见 Geohash 有关Geohash的更多信息。
11.6.6. 空间关系¶
11.6.6.1. st_area¶
Double st_area(Geometry g)
If Geometry
g is areal, returns the area of its surface in square units of the coordinate reference system
(for example, degrees^2 for EPSG:4326). Returns 0.0 for non-areal geometries (e.g. Point
s, non-closed
LineString
s, etc.).
11.6.6.2. st_centroid¶
Point st_centroid(Geometry g)
返回几何图形的几何中心。
11.6.6.3. st_closestPoint¶
Point st_closestPoint(Geometry a, Geometry b)
返回 Point
在……上面 a 最接近于 b 。这是最短直线的第一个点。
11.6.6.4. st_contains¶
Boolean st_contains(Geometry a, Geometry b)
当且仅当没有 b 躺在…的外面 a ,和至少一个点的内部 b 位于…的内部 a 。
11.6.6.5. st_covers¶
Boolean st_covers(Geometry a, Geometry b)
Returns true if no point in Geometry
b is outside Geometry
a.
11.6.6.6. st_crosses¶
Boolean st_crosses(Geometry a, Geometry b)
如果提供的几何图形有一些(但不是全部)共有的内部点,则返回TRUE。
11.6.6.7. st_difference¶
Geometry st_difference(Geometry a, Geometry b)
返回输入几何图形的差值。
11.6.6.8. st_disjoint¶
Boolean st_disjoint(Geometry a, Geometry b)
如果几何图形在空间上不相交,即它们不共享任何空间,则返回True。相当于 NOT st_intersects(a, b)
。
11.6.6.9. st_distance¶
Double st_distance(Geometry a, Geometry b)
以坐标参考系为单位返回两个几何图形之间的二维笛卡尔距离(例如,EPSG:4236的度数)。
11.6.6.10. st_distanceSphere¶
Double st_distanceSphere(Geometry a, Geometry b)
假设地球为球形,则近似表示两个经度/纬度几何图形之间的最小距离。
11.6.6.11. st_distanceSpheroid¶
Double st_distanceSpheroid(Geometry a, Geometry b)
返回假设为WGS84椭球体的两个经度/纬度几何图形之间的最小距离。
11.6.6.12. st_equals¶
Boolean st_equals(Geometry a, Geometry b)
如果给定的几何表示相同的逻辑几何,则返回TRUE。方向性被忽略。
11.6.6.13. st_intersection¶
Geometry st_intersection(Geometry a, Geometry b)
返回输入几何图形的交集。
11.6.6.14. st_intersects¶
Boolean st_intersects(Geometry a, Geometry b)
如果几何图形在2D中空间相交(即共享空间的任何部分),则返回True。相当于 NOT st_disjoint(a, b)
。
11.6.6.15. st_length¶
Double st_length(Geometry geom)
返回线性几何图形的2D路径长度,或区域几何图形的周长,以坐标参考系为单位(例如,EPSG:4236的度数)。对于其他几何体类型(例如,点),返回0.0。
11.6.6.16. st_lengthSphere¶
Double st_lengthSphere(LineString line)
的2D路径长度近似 LineString
使用球形地球模型的几何图形。返回的长度以米为单位。该近似值在st_LengthSpheroid的0.3%以内,计算效率更高。
11.6.6.17. st_lengthSpheroid¶
Double st_lengthSpheroid(LineString line)
的二维路径长度。 LineString
使用WGS84椭球体上的经度/纬度坐标定义的几何图形。返回的长度以米为单位。
11.6.6.18. st_overlaps¶
Boolean st_overlaps(Geometry a, Geometry b)
如果几何图形有一些共同的点,但不是所有的点都相同,并且两个几何图形的内部交点的尺寸与几何图形本身的尺寸相同,则返回TRUE。
11.6.6.19. st_relate¶
String st_relate(Geometry a, Geometry b)
返回 DE-9IM 3x3交互矩阵模式,描述两个几何图形的内部、边界和外部之间的交点的维度。
11.6.6.20. st_relateBool¶
Boolean st_relateBool(Geometry a, Geometry b, String mask)
如果返回True,则 DE-9IM 交互矩阵掩码 mask 获取的交互矩阵模式匹配 st_relate(a, b)
。
11.6.6.21. st_touches¶
Boolean st_touches(Geometry a, Geometry b)
如果几何图形至少有一个共同点,但其内部不相交,则返回True。
11.6.6.22. st_transform¶
Geometry st_transform(Geometry a, String fromCRS, String toCRS)
返回坐标转换到不同坐标参考系的新几何图形(例如,从epsg:4326到epsg:27700)。
11.6.6.23. st_within¶
Boolean st_within(Geometry a, Geometry b)
如果是几何图形,则返回True a 完全在几何体内部 b 。
11.6.7. 几何处理¶
11.6.7.1. st_antimeridianSafeGeom¶
Geometry st_antimeridianSafeGeom(Geometry geom)
如果 geom 横跨 antimeridian ,尝试将几何转换为等效形式,该形式是“反地线安全的”(即,输出几何由 BOX(-180 -90, 180 90)
)。在某些情况下,此方法可能会失败,在这种情况下,将返回输入几何图形并记录错误。
11.6.7.2. st_bufferPoint¶
Geometry st_bufferPoint(Point p, Double buffer)
Returns a Geometry
covering all points within a given radius of Point
p, where radius is given in meters.
11.6.7.3. _st_makeValid¶
Geometry st_makeValid(Geometry geom)
返回有效的 Geometry
。此函数的行为类似于PostGIS函数 st_makeValid(geom, 'method=structure') 。该函数不会折叠几何图形,而可能返回空几何图形。无效的多重几何图形可以简化为规则几何图形。
11.6.7.4. st_convexHull¶
Geometry st_convexHull(Geometry geom)
Aggregate function. 几何的凸包表示包含所有几何的最小凸几何 geom 在聚合行中。
11.6.7.5. st_idlSafeGeom¶
的别名 st_antimeridianSafeGeom 。