英文:
Spatial select on table with geometry from another table
问题
SELECT geom from hexgrids where value > 0.5 as hexselection
SELECT * from othertable where ST_Within(geom, hexselection)
英文:
Say I have two tables, one a table of hexagons called hexgrids and another table of other features called othertable.
I'd like to select features from othertable where they intersect features in hexgrids with value > 0.5
Essentially I am trying to use the result of one query as a spatial selection on another table.
SELECT geom from hexgrids where value > 0.5 as hexselection
SELECT * from other table where ST_Within( geom, hexselection)
答案1
得分: 1
你可以使用空间谓词和其他条件来加入:
SELECT *
FROM table1
JOIN table2
ON st_intersects(table1.geom, table2.geom)
WHERE table2.value > 0.5
英文:
You can join using the spatial predicate and any other conditions
SELECT *
FROM table1
JOIN table2
ON st_intersects(table1.geom, table2.geom)
WHERE table2.value > 0.5
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论