如何在PostGIS中获取与给定圆相交的所有圆?

时间:2016-06-19 19:38:34

标签: python postgresql geometry postgis intersection

我试图找出与给定圆相交或重叠的数据库中存储的所有圆圈(圆圈遍布世界各地)。我已经存储了这样的圈子:

CREATE TABLE circles(gid serial PRIMARY KEY, name varchar, code integer, the_geog geography(POLYGON,4326) );

INSERT INTO circles (gid, name, code, the_geog) VALUES (1,"hello", 11,geometry(ST_Buffer(geography(ST_GeomFromText('POINT(48.732084 -3.459144)')), 1000)));

现在,当我试图查找与给定圈子相交的所有圈子时,我收到此错误:

ERROR:  Only lon/lat coordinate systems are supported in geography.

我使用此查询获取数据:

select * from circles where st_intersects (circles.the_geog,ST_Buffer(ST_Transform(ST_GeomFromText('POINT(-105.04428 39.74779)', 4326), 2877), 1500));

谁能告诉我我做错了什么?

1 个答案:

答案 0 :(得分:0)

我通过使用:

来实现这一目标
select * from circles where st_intersects (circles.the_geog,geometry(ST_Buffer(geography(ST_GeomFromText('POINT(13.28527 52.521711)')), 1000)));