使用Sgt_asText(point(longitude, latitude))的mysql查询在PotgreSql中的



我想在以下Postgres查询(在post的末尾)中使用具有经度和纬度的点,但我得到这个错误:

ERROR:  function st_astext(point) does not exist
LINE 1: ...CONCAT_WS(',', 'GEOMETRYCOLLECTION(',group_concat(st_asText(...
^
HINT:  No function matches the given name and argument types. You might need to add explicit type casts.

SQL查询:

SELECT ogc_fid, name, CONCAT_WS(',', 'GEOMETRYCOLLECTION(',group_concat(st_asText(point(longitude, latitude))),',',st_astext(geometry),')') as shape FROM locationshape WHERE locationshape.location_id IS NULL AND st_contains(geometry, point(longitude, latitude));

point()创建,即本地postgres类型

ST_point()将创建一个点几何,它是Postgis类型,可用于其他Postgis功能,如st_asText

select st_asText(st_point(1,2));
st_astext
------------
POINT(1 2)
(1 row)

话虽如此,您可能想看看st_collect如何从几何图形而不是从文本创建几何集合。

最新更新