【发布时间】:2021-07-17 00:41:36
【问题描述】:
我有一张表 graphs 和一列 bbox。
此列包含几何图形,我将各种 bbox 保存在那里
SELECT AddGeometryColumn('graphs', 'bbox', 4326, 'POLYGON', 2 );
如何检查column bbox 中的哪个Bbox 放置了当前bbox?
据我所知,我必须使用 ST_Contains 来做这件事,但我需要一些关于语法的帮助。
我试过这种方法:
SELECT bbox,BBOX_Diagonale,file FROM graphs WHERE ST_CONTAINS(bbox,ST_MakeEnvelope( 11.58624574 , 47.71313579 , 12.21446607 , 48.13538804 , 4326)) order by BBOX_Diagonale ASC LIMIT 1;
我的表有这些值:
-[ RECORD 1 ]-----------------------------
left_xmin | 11.66952931
bottom_ymin | 47.79336862
right_xmax | 12.18612053
top_ymax | 48.14030283
filename | my_sfn_cache1619119545.38177
-[ RECORD 2 ]-----------------------------
left_xmin | 11.58624574
bottom_ymin | 47.71313579
right_xmax | 12.21446607
top_ymax | 48.13538804
filename | my_sfn_cache1619119600.90796
所以这个查询应该至少为我提供表中的一个条目?
【问题讨论】:
标签: postgresql gis postgis