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

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to write a query in Postgis which will return all rows where a dynamically changing longitude/latitude point resides within the geometric polygon of that row (in the geom column). This is the query I'm trying to use:

SELECT * FROM "geospatial-data" 
WHERE ST_Contains(
    "geospatial-data".geom,
    ST_Transform(
        ST_GeomFromText('POINT(-90.56210 38.60369)', 4326), 4269
    )
)=true

I'm basing this query off of an older post here: http://codemagician.wordpress.com/2009/09/12/point-in-polygon-in-postgis/

I'm not getting any errors but I can't understand what I'm doing wrong. How should I write/modify the query in order to query for a point-in-polygon?

share|improve this question
    
that one return true when given point is in given geospatial-data geometry. so it work like intended – simplexio Jun 17 '13 at 11:59
    
Really? I thought it will select everything where the "WHERE" condition is true. It shouldn't be returning true, instead, it should be returning the rows of data where the condition equals true. Or am I missing something? – Glen Selle Jun 17 '13 at 13:54
    
Well, it does return those rows (=true is not needed really). So if you're not getting data you want the problem is with data. – Jakub Kania Jun 19 '13 at 12:39
    
you also might want to provide a link to your polygon data – clhenrick Apr 20 '15 at 1:25
    
Perhaps the SRID of "geospatial-data" is not 4269 in your data. – user30184 Apr 15 at 21:30

It works to me when i avoid the mismatch SRID's. SRID's must be identical

share|improve this answer

We're looking for long answers that provide some explanation and context. Don't just give a one-line answer; explain why your answer is right, ideally with citations. Answers that don't include explanations may be removed.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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