[GIS] How to write a point-in-polygon query for Postgis

polygonpostgispostgresql

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?

Best Answer

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

Related Question