Skip to content Skip to sidebar Skip to footer

St_contains In Athena

the below code should return true but returns false. I tested in google maps and point lies in the polygon. I am not sure what is the issue here. I am running this code in Athena s

Solution 1:

Here is the response I obtained from the Athena team:

The root cause is the string to create the polygon is in wrong format. If you run this query:

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

then the error message states: corrupted geometry

The correct format/syntax, according to the Well-Known Text (WKT) should be:

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

and it will return true.

Post a Comment for "St_contains In Athena"