【问题标题】:How to get all circles that intersect a given circle in PostGIS?如何在 PostGIS 中获取与给定圆相交的所有圆?
【发布时间】:2016-06-19 19:38:34
【问题描述】:

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

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

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

【问题讨论】:

    标签: python postgresql geometry postgis intersection


    【解决方案1】:

    我通过以下方式完成了这项工作:

    select * from circles where st_intersects (circles.the_geog,geometry(ST_Buffer(geography(ST_GeomFromText('POINT(13.28527 52.521711)')), 1000)));
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2014-12-30
      • 1970-01-01
      • 2014-05-01
      • 1970-01-01
      • 1970-01-01
      • 2012-02-07
      • 2019-04-25
      相关资源
      最近更新 更多