我正在尝试运行此
SELECT
*
FROM
creator.maps
WHERE
ST_DISTANCE(
ST_POINT(10,10)::geography,
ST_POINT(geolocation)::geography
)
< 50000;
但这给了我错误:
HINT: No function matches the given name and argument types. You might need to add explicit type casts.
地理位置是POINT类型
我该如何解决?
错误:
ERROR: function st_point(point) does not exist
答案 0 :(得分:0)
可以先将类型point
转换为PostGIS geometry
,然后再转换为geography
。
SELECT
*
FROM
creator.maps
WHERE
AND ST_DISTANCE(
ST_POINT(10,10)::geography,
geolocation::geometry::geography
)
< 50000;
请注意,Postgres本机geometric functions受限制,因此您可能需要考虑将数据存储为geometry(point)
而不是point