1
votes

I have two tables. First with points, and second with polygons. I need to find out which points are in required polygon according to the attribute gid.

Using query: SELECT table1.* FROM table1, table2 WHERE table2.gid=1 AND ST_Contains(table2.geom2, table1.geom1);

What I get is empty table (only columns without data)...

Tnx

1

1 Answers

1
votes

Are you sure there are any intersecting points? Try

 SELECT COUNT(*) FROM table2 WHERE table2.gid=1 

It should return 1.

Another thing you could try is using ST_Intersects instead of ST_Contains.

Otherwise, you might need to post some data dumps of data you think should match.