4

I've got a large set of LAT/LON coordinates. Up until now, when I needed to select out those that fell within a certain region, I'd just create a bounding box using some MINx, MAXx, MINy, MAXy values and try to get it as close as possible to the area I was interested in.

I'd like to get more precise by using more than 4 points as the extent of my search area, in this specific case, 14 points.

I'll probably be using Python or SQL for this, so the specific syntax on any solution isn't that important, I'm just interested in the formula for figuring this one out.

1

2 Answers 2

4

You could use Shapely to perform the operation (e.g. within). You could load both geometries via one Shapely's methods for interoperation.

0
2

PostGIS has a collection of relational operators that should do what you want.

2
  • SELECT * FROM pointstable, polygonstable WHERE st_intersects(pointstable.geom, polygonstable.geom)=TRUE
    – Pablo
    Commented Jul 1, 2011 at 22:01
  • 1
    specifically: ST_Contains or ST_Within (possibly ST_DWithin if you want to overcompensate for rounding errors)
    – Mike T
    Commented Jul 1, 2011 at 23:10

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.