【发布时间】:2019-07-29 11:57:49
【问题描述】:
我有一个名为 all_the_points 的表,其中包含一行中每个元素的多个点,现在所有元素都在名为 origin 的列中,
现在每个元素都可以有几个点,我可以在一个视图中通过 PostGIS 上不同图层上的元素将所有点分开,我尝试使用 group by 但当我拖动到我的qgis。
谢谢你
with
bounds as (
select
origin
,min(x) as xmin
,min(y) as ymin
,max(x) as xmax
,max(y) as ymax
from all_the_points
group by WHERE ((all_the_points.origin)::text = '126af84e-0a9b-407d-8036-1ffc316106dd'::text);
)
select
origin
,st_makepolygon(st_makeline(array[
st_makepoint(xmin,ymin)
,st_makepoint(xmax,ymin)
,st_makepoint(xmax,ymax)
,st_makepoint(xmin,ymax)
,st_makepoint(xmin,ymin)
]))
from bounds
【问题讨论】:
标签: postgresql postgis qgis