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.