So I have a table with approximately 10k rows, with each row having its corresponding geometry entry. What I am attempting to do is count how many row geometries are contained/within the geometry of a single row as follows:
SELECT id, COUNT(*) FROM poly_table
WHERE WITHIN(poly_table.geom, poly_table.geom)
GROUP BY id ORDER BY COUNT(*) DESC;
However, all I get in return is a table with all rows having a COUNT(*)
value of 1
. So in understand they will certainly contain themselves but there are definitely polygons within polygons that are not accounted for.