Tell me more ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I'm working in a project and I need to use postgis to get all the States contains in a City, now, I tried the following query:

SELECT * FROM Table1, Table2 WHERE ST_Contains(Table1.the_geom, Table2.the_geom) and Table1.id = 4

The query returns some of the locations but not all (exactly 6 of 13).

Maybe another better method for this? or I'm dealing with a bad DB ?

Please Help!

share|improve this question
2  
This question seems to lack some information. What is table1 and what is table2? Why do you filter for id = 4? Do you mean states containing a city? A certain one or any? – underdark Feb 4 at 19:09

closed as not a real question by underdark Mar 6 at 20:38

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, see the FAQ.

1 Answer

Try the query using ST_Intersects instead of ST_Contains.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.