Mysql点数据类型& glength返回null

时间:2011-05-29 16:23:41

标签: mysql sql geospatial spatial

以下glength()语句始终返回null。

SET @mref_point1=point(12.937060,77.671280);
SET @mref_point2=point(13.937060,73.271280);

SELECT GLENGTH(LINESTRINGFROMWKB(linestring(ASBINARY(@mref_point1),ASBINARY(@mref_point2))));

有人能指出我正确的方向。

1 个答案:

答案 0 :(得分:1)

我发布此答案,以便更容易阅读代码:

尝试通过以下步骤缩小问题范围:

select ASBINARY(@mref_point1)

如果不返回null,请继续执行:

select linestring(ASBINARY(@mref_point1),ASBINARY(@mref_point2))

如果不返回null,请继续执行:

select LINESTRINGFROMWKB(linestring(ASBINARY(@mref_point1),ASBINARY(@mref_point2)))