PostGis -> ST_Contains: 如何检查 table 的哪个 BBox 是当前 BBox
PostGis -> ST_Contains: how to check in which BBox of a table is the current BBox
我有一个 table graphs
列 bbox
.
此列包含几何图形,我在那里保存了各种 bboxes
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;
我的 table 有这些值:
-[ 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
所以这个查询应该至少为我提供一个来自 table?
的条目
我在写入数据库的地方犯了一个小错误。基本上是数字混淆。无论如何,如果有人想知道如何在 db 中找到其他 bbox 中的 bbox,这就是您的方法。
我有一个 table graphs
列 bbox
.
此列包含几何图形,我在那里保存了各种 bboxes
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;
我的 table 有这些值:
-[ 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
所以这个查询应该至少为我提供一个来自 table?
的条目我在写入数据库的地方犯了一个小错误。基本上是数字混淆。无论如何,如果有人想知道如何在 db 中找到其他 bbox 中的 bbox,这就是您的方法。