使用ST_SPHERICALDISTANCE的两个地理坐标之间的Teradata距离

时间:2016-09-29 01:48:53

标签: sql geospatial teradata

我已经阅读过Teradata版本13中的内容,您可以使用ST_SPHERICALDISTANCE来计算地理距离。 我在Teradata中写了一个简单的测试查询:

Select
Cast('POINT(-35.0000, 150.0000)' As ST_GEOMETRY) As location1,
Cast('POINT(-35.0000, 149.0000)' As ST_GEOMETRY) As location2,
location1.ST_SPHERICALDISTANCE(location2) As Distance_In_km

但收到以下错误:

  

未交付Teradata行(trget):13   OGRGeometryFactoryX :: createFromWkt失败。

这是查询或配置的问题吗? 感谢

1 个答案:

答案 0 :(得分:2)

只需删除点定义中的逗号:)

Select
Cast('POINT(-35.0000 150.0000)' As ST_GEOMETRY) As location1,
Cast('POINT(-35.0000 149.0000)' As ST_GEOMETRY) As location2,
location1.ST_SPHERICALDISTANCE(location2) As Distance_In_km

顺便说一句,另一种创造点的方法:

NEW ST_GEOMETRY('POINT(-35.0000 150.0000)')