I'm trying to find all the geography points that are contained in a geography polygon, let say all the traffic lights within a given city or neighborhoods,

how can i convert this working st_intersect query to work with contained and remain with geographies not geometries

select count(*) from table1
where table1.UniqueID in (
SELECT table1.UniqueID
FROM table1 INNER JOIN table2 ON ST_Intersects(table1.point, table2.polygon)
where table2.UniqueID = 2); 
  • Welcome to gis.SE. What have you already looked at? What have you already tried? What worked? What didn't work the way you expected, and what happened instead? What version of postgis? Those are important bits of information you can add by clicking edit below the question. Otherwise, the answer is just "postgis.net/docs/ST_Intersects.html says it works with geography, so what is the problem with what you already have?" – BradHards Dec 24 '13 at 1:12

For the point/polygons case, ST_Contains and ST_Intersects are equivalent.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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