雅典娜中的st_contains

时间:2020-06-23 13:15:08

标签: sql amazon-athena

以下代码应返回true,但返回false。我在谷歌地图上测试过,点位于多边形上。我不确定这是什么问题。我在雅典娜上运行这段代码

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))  

1 个答案:

答案 0 :(得分:0)

这是我从雅典娜团队获得的回复:

根本原因是用于创建多边形的字符串格式为错误的格式。如果您运行此查询:

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

根据Well-Known Text (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