雅典娜所包含的sql语句

tzdcorbm  于 2021-07-24  发布在  Java
关注(0)|答案(1)|浏览(375)

下面的代码应该返回true,但返回false。我在谷歌Map上测试过,点位于多边形中。我不知道这里有什么问题。我在雅典娜运行这个代码

select 
st_contains (st_polygon( 'POLYGON((54.8163815 24.9474831),
(54.9310513 24.8914383),
(55.0514856 24.8349286),
(55.1170345 24.9527804),
(55.1686306 25.0937019),
(55.3738202 25.1844963),
(55.3676957 25.3050482),
(55.2592057 25.3944044),
(54.8163815 24.9474831))'),st_point(55.163485,25.092776))
rqqzpn5f

rqqzpn5f1#

以下是我从雅典娜团队得到的回应:
根本原因是创建多边形的字符串格式错误。如果运行此查询:

select st_geometry_to_text(st_polygon('POLYGON((54.8163815 24.9474831),
(54.9310513 24.8914383),
(55.0514856 24.8349286),
(55.1170345 24.9527804),
(55.1686306 25.0937019),
(55.3738202 25.1844963),
(55.3676957 25.3050482),
(55.2592057 25.3944044),
(54.8163815 24.9474831))'));

然后错误消息说明: corrupted geometry 根据众所周知的文本(wkt),正确的格式/语法应为:

select st_contains('POLYGON(
(54.8163815 24.9474831,
54.9310513 24.8914383,
55.0514856 24.8349286,
55.1170345 24.9527804,
55.1686306 25.0937019,
55.3738202 25.1844963,
55.3676957 25.3050482,
55.2592057 25.3944044,
54.8163815 24.9474831))',
st_point(55.163485,25.092776));

它会回来的 true .

相关问题