views:

88

answers:

1

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

A: 

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.

fmark
I found out SRID is not the same. Different coordinate systems:) After I fix it I will try query you suggested.
Z77