GeoSparkSQL Function

sparkSQL函数

Geometry 创建

1. st_box2DFromGeoHash:

Geometry st_box2DFromGeoHash(String geohash, Int prec)

st_geomFromGeoHash的别名

2.st_geomFromGeoHash:

Geometry st_geomFromGeoHash(String geohash, Int prec)

根据Geohash字符串(base-32)返回对应的边界框的几何形状。

3. st_geomFromText:

Geometry st_geomFromText(String wkt)

st_geomFromWKT的别名

4.st_geomFromWKB:

Geometry st_geomFromWKB(Array[Byte] wkb)

根据给定的WKB创建几何图形。

5.st_geomFromWKT:

Geometry st_geomFromWKT(String wkt)

根据给定的WKT创建几何图形。

6.st_geometryFromText:

Geometry st_geometryFromText(String wkt)

st_geomFromWKT的别名

7.st_lineFromText:

LineString st_lineFromText(String wkt)

根据给定的WKT表示创建一个LineString。

8.st_mLineFromText:

MultiLineString st_mLineFromText(String wkt)

根据WKT创建MultiLineString 。

9.st_mPointFromText:

MultiPoint st_mPointFromText(String wkt)

根据WKT创建MultiPoint 。

10.st_mPolyFromText:

MultiPolygon st_mPolyFromText(String wkt)

根据WKT创建MultiPolygon 。

11.st_makeBBOX:

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

根据边界框创建Geometry 。

12.st_makeBox2D:

Geometry st_makeBox2D(Point lowerLeft, Point upperRight)

根据两个点创建一个Geometry 。

13.st_makeLine:

LineString st_makeLine(Seq[Point] points)

根据一个点的集合创建一条LineString

14.st_makePoint:

Point st_makePoint(Double x, Double y)

根据两个double值创建一个point。

15.st_makePointM:

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

根据三个double值创建一个point。

16.st_makePolygon:

Polygon st_makePolygon(LineString shell)

根据一些LineString创建一个Polygon ,这些LineString必须是闭合的。

17.st_point:

Point st_point(Double x, Double y)

根据两个double值创建一个point。是st_makePoint的别名。

18.st_pointFromGeoHash:

Point st_pointFromGeoHash(String geohash, Int prec)

返回由Geohash字符串 (base-32)定义的边界框几何中心的点。

19.st_pointFromText:

Point st_pointFromText(String wkt)

根据WKT创建point;

20.st_pointFromWKB:

Point st_pointFromWKB(Array[Byte] wkb)

根据WKB创建point。

21.st_polygon:

Polygon st_polygon(LineString shell)

根据一些LineString创建一个Polygon ,这些LineString必须是闭合的。

22.st_polygonFromText:

Polygon st_polygonFromText(String wkt)

根据WKT创建Polygon 。

Geometry 访问器

1.st_boundary:

Geometry st_boundary(Geometry geom)

返回边界,如果geom为空,则返回适当维度的空geometry 。

2.st_coordDim:

Int st_coordDim(Geometry geom)

返回几何坐标geom的维数。

3.st_dimension:

Int st_dimension(Geometry geom)

返回此几何对象的固有维数,它必须小于或等于坐标维数。

4.st_envelope:

Geometry st_envelope(Geometry geom)

返回表示geom边界框的Geometry 。

5.st_exteriorRing:

LineString st_exteriorRing(Geometry geom)

返回表示geometry外部环的行LineString ;如果Geometry不是Polygon,则返回null。

6.st_geometryN:

Int st_geometryN(Geometry geom, Int n)

如果该Geometry 是GeometryCollection,返回geom的第n个Geometry (从1开始);如果不是,则返回geom。

7.st_interiorRingN:

Int st_interiorRingN(Geometry geom, Int n)

返回geom(Polygon 类型)的第n个内部LineString 环。如果geometry 不是Polygon 或给定的n超出范围,则返回null。

8.st_isClosed:

Boolean st_isClosed(Geometry geom)

如果geom是一个LineString或MultiLineString,并且它的起点和终点是重合的,则返回true。对所有其他Geometry返回true。

9.st_isCollection:

Boolean st_isCollection(Geometry geom)

如果geom是一个GeometryCollection,则返回true。

10.st_isEmpty:

Boolean st_isEmpty(Geometry geom)

如果geom为空,则返回true。

11.st_isRing:

Boolean st_isRing(Geometry geom)

如果geom是一个LineString或一个MultiLineString,并且是封闭的,则返回true。

12.st_isSimple:

Boolean st_isSimple(Geometry geom)

如果geom没有异常的几何点,如存在相交点或者相切,则返回true。

13.st_isValid:

Boolean st_isValid(Geometry geom)

如果Geometry 根据OGC SFS规范在拓扑上有效,则返回true。

14.st_numGeometries:

Int st_numGeometries(Geometry geom)

如果geom是GeometryCollection,则返回geometries的数量。对于单个几何图形,返回1。

15.st_numPoints:

Int st_numPoints(Geometry geom)

返回几何geom中的顶点数。

16.st_pointN

Point st_pointN(Geometry geom, Int n)

如果geom是一个LineString,则返回geom的第n个顶点作为一个点。负值从LineString的末尾向后计数。如果geom不是一个LineString,则返回null。

17.st_x:

Float st_X(Geometry geom)

如果geom是一个点,返回该点的X坐标。

18.st_y:

Float st_y(Geometry geom)

如果geom是一个点,返回该点的Y坐标。

Geometry投影

1.st_castToLineString

LineString st_castToLineString(Geometry g)

将Geometry 类型的g投影成LineString。

2.st_castToPoint:

Point st_castToPoint(Geometry g)

将Geometry 类型的g投影成point。

3.st_castToPolygon:

Polygon st_castToPolygon(Geometry g)

将Geometry 类型的g投影成Polygon。

4.st_castToGeometry:

Geometry st_castToGeometry(Geometry g)

将几何子类g强制转换为Geometry。在case class中,使用st_makePoint输出一个Geometry 时,这个函数是必要的。

5. st_byteArray:

Array[Byte] st_byteArray(String s)

将一个字符串使用UTF8转为Byte数组。

Geometry编辑器

1.st_translatest_translate:

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

返回由deltaX和deltaY转换为geom时生成的Geometry 图形。(???)

Geometry 输出

1.st_asBinary:

Array[Byte] st_asBinary(Geometry geom)

返回WKB表示的几何geom。

2.st_asGeoJSON:

String st_asGeoJSON(Geometry geom)

返回GeoJSON表示的几何geom。

3.st_asLatLonText:

String st_asLatLonText(Point p)

返回一个字符串,该字符串以度、分和秒(degrees, minutes, and seconds)为单位描述点p的经纬度。(假设p的坐标单位是经纬度)

4.st_asText:

String st_asText(Geometry geom)

返回WKT表示的几何geom。

5.st_geoHash:

String st_geoHash(Geometry geom, Int prec)

返回几何geom内部点的Geohash(以base-32表示)。

Spatial 关系

1.st_area:

Double st_area(Geometry g)

如果Geometry g是一个面,则返回这个面的面积,单位为坐标参考系的平方。对于非面的geometries (Points,非闭合的LineStrings),返回0.0。

2.st_centroid:

Point st_centroid(Geometry g)

返回geometry的几何中心。

3.st_closestPoint:

Point st_closestPoint(Geometry a, Geometry b)

返回a到b最近的Point ,也就是最短线上的第一个点。

4.st_contains:

Boolean st_contains(Geometry a, Geometry b)

如果 b的任何点都不在a的外面并且b至少有一个点在a里面 ,则返回true。

5.st_covers:

Boolean st_covers(Geometry a, Geometry b)

如果b中没有点在a之外,则返回true(a是否包含b)。

6.st_crosses:

Boolean st_crosses(Geometry a, Geometry b)

如果提供的Geometry存在相同的内部点,则返回true

7.st_disjoint:

Boolean st_disjoint(Geometry a, Geometry b)

geometries 不相交,则返回true;即。等价于NOT st_intersects(a, b)。

8.st_distance:

Double st_distance(Geometry a, Geometry b)

返回两个geometries 之间的二维笛卡尔距离,单位为坐标参考系

9.st_distanceSphere:

Double st_distanceSphere(Geometry a, Geometry b)

假设地球是球型,返回两个geometries 之间的最小距离。

10.st_distanceSpheroid:

Double st_distanceSpheroid(Geometry a, Geometry b)

假设地球为WGS84 球型,返回两个geometries 之间的最小距离。

11.st_equals:

Boolean st_equals(Geometry a, Geometry b)

判断两个Geometries 是否相同,不考虑方向。

12.st_intersects:

Boolean st_intersects(Geometry a, Geometry b)

如果两个geometries 在二维空间相交,则返回true。相当于NOT st_disjoint(a, b)。

13.st_length:

Double st_length(Geometry geom)

返回线性geometries的二维路径长度,或面积geometries的周长,单位为坐标参考系统。如果为其他几何类型(例如Point),返回0.0。

14.st_lengthSphere:

Double st_lengthSphere(LineString line)

假设地球为球型,返回LineString 的路径长度。返回的长度以米为单位。与st_lengthSpheroid的差值在0.3%以内,但计算效率更高。

15.st_lengthSpheroid:

Double st_lengthSpheroid(LineString line)

假设地球为WGS84球型,返回LineString路径长度。返回的长度以米为单位。

16.st_overlaps:

Boolean st_overlaps(Geometry a, Geometry b)

如果两个geometries 存在共同点,并且具有相同的维数,并且两个geometries 的交集和geometries 本身的维数相同,则返回true。

17.st_relate:

String st_relate(Geometry a, Geometry b)

返回 3x3矩阵,描述两个geometries的内部、边界和外部之间的交集的维数。

18.st_relateBool:

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

如果矩阵掩码(???)和st_relate(a, b)中返回的矩阵匹配,则返回true

19.st_touches:

Boolean st_touches(Geometry a, Geometry b)

如果geometries 至少有一个共同点,但内部不相交,则返回true。

20.st_within:

Boolean st_within(Geometry a, Geometry b)

如果geometry a完全在geometry b中,则返回true。

Geometry 处理

1.st_antimeridianSafeGeom:

Geometry st_antimeridianSafeGeom(Geometry geom)

????

2.st_bufferPoint:

Geometry st_bufferPoint(Point p, Double buffer)

返回一个Geometry ,该Geometry 会覆盖点p给定半径内的所有点,其中半径以米为单位。
(一个圆)

3.st_convexHull:

Geometry st_convexHull(Geometry geom)

合函数。geometry 的凸包表示在聚合行中包含所有几何geom的最小凸geometry 。
(???)

4.st_idlSafeGeom:

st_antimeridianSafeGeom.的别名。

  • 3
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值