简体   繁体   中英

Postgis ST_Contains polygon one table

I have a postgis spatial table with polygons in it, having an id ( gid ) and a geometry column named way (which actually stores the polygon boundary). The tablehead looks as follows:

|| gid (integer) | way (geometry) ||

Every column in this table is representing a polygon. Now I want to take two specific polygons out of this table (select them by the gid) and use ST_Contains() to test if one is contained by the other.

What is the SQL Syntax for this?

Try the following:

SELECT st_contains(a.way, b.way)
FROM yourtable AS a, yourtable AS b
WHERE 
    a.gid = yourfirstid
    AND b.gid = yoursecondid

Is that all you wanted to know, or did I misinterpret the question?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM