3

I'm developing a project using PostGIS to hold spatial data where I have records that hold geometry point data and records that hold geometry area data. To solve my problem I'm looking for two queries that can take geographic shapes rather than geometric shapes as parameters.

For query A I need it to return all points that intersect with a given area.

For query B I need it to return all areas that intersect with a given point.

1 Answer 1

4

ST_Intersects works for both Geography and Geometry data types so there should be no problem at all.

SELECT * 
FROM my_pts JOIN my_areas
ON ST_Intersects(my_pts.the_geog,my_areas.the_geog)
2
  • According to your link, ST_Intersects returns a boolean, not actual points of intersection, so this question hasn't been answered.
    – user10201
    Commented Sep 13, 2012 at 19:01
  • 1
    @osdev ForeignerBR mentions that he wants to select existing points within an area so it is not necessary to calculate intersection points. The question therefore is answered.
    – underdark
    Commented Sep 14, 2012 at 6:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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