更新时间:2023-01-30 21:07:26
As per the specification of ST_geomFromText()
(geomfromtext()
is a deprecated synonym, you should not use it):
如果geometry参数是
NULL
或不是语法上格式正确的几何,或者SRID参数是NULL
,则返回值是NULL
.
If the geometry argument is
NULL
or not a syntactically well-formed geometry, or if the SRID argument isNULL
, the return value isNULL
.
实际上,您的论点的语法格式不正确,因为每个坐标都包含两个点.您可以使用以下简单方法进行检查:
Indeed your argument is not syntactically well-formed, as each coordinate contains two dots. You can check this with a simple:
select geomfromtext('Point(10.20.45 34.23.79)')
结果(尝试在线):
(空)
只有一个点,它可以工作:
With a single dot, it works:
select geomfromtext('Point(10.2045 34.2379)')
结果(真正在线)
AAAAAAEBAAAAYhBYObRoJED129eBcx5BQA ==
AAAAAAEBAAAAYhBYObRoJED129eBcx5BQA==
ST_PointFromText(()
,除了您仍然需要使用 WKT格式,因此您还需要使用POINT()
:
The same applies to ST_PointFromText(()
, except you still need to use the WKT format so you need to use POINT()
as well:
select pointfromtext('point(10.2045 34.2379)')
结果(尝试在线):
AAAAAAEBAAAAYhBYObRoJED129eBcx5BQA ==
AAAAAAEBAAAAYhBYObRoJED129eBcx5BQA==
这两个函数基本上相同,除了pointfromtext()
会强制得出点结果.
Basically the two functions are the same, except pointfromtext()
enforces a point result.