2
我在我的PostgreSQL數據庫(版本9.3)中有一個包含多邊形的列geom的表。然後我有一個線對象,它構建了一個邊界。我試圖用邊界對象內的所有geom對象來構建一個視圖。PostGIS:通過邊界過濾多邊形
我試過的功能ST_Within(不能處理multipolygons)和ST_Intersects ...
這裏是我的SQL命令:
CREATE VIEW buildings_intersect_boundary AS
SELECT ROW_NUMBER() OVER (ORDER BY "buildings".gid ASC) AS ROW_NUMBER,
"buildings".name,"buildings".type,
"buildings".geom
FROM "buildings" INNER JOIN "boundary" ON
ST_Intersects("buildings".geom,"boundary".geom)
在我使用邊框解決問題的時刻:
CREATE VIEW osm_buildings_intersect_project_boundary AS
SELECT ROW_NUMBER() OVER (ORDER BY "buildings_fromOSMShape".gid ASC) AS ROW_NUMBER,
"buildings_fromOSMShape".name,"buildings_fromOSMShape".type,
"buildings_fromOSMShape".geom
FROM "buildings_fromOSMShape" INNER JOIN "boundary_project_area" ON
"buildings_fromOSMShape".geom @ "boundary_project_area".geom
但這返回的對象太多......
工作系統:Ubuntu 14.04
嘿約翰,thx爲您的答案。我試過了,數據無法顯示。不幸的是,我認爲你的查詢不會幫助我。官方文檔說,幾何集合不支持(http://postgis.refractions.net/documentation/manual-1.4/ST_Contains.html [鏈接])...任何其他建議? – user3806723
啊,你有幾何集合。是的,他們很難與之合作。你只有多邊形和多面體,還是你有線條和點? –
我認爲只有多邊形,但不幸的是我不能排除,還有一些其他幾何... – user3806723