Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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.

share|improve this question
2  
You might find discussions about concave and convex hulls to be relevant: gis.stackexchange.com/… –  whuber Jul 1 '11 at 17:13
add comment

2 Answers

up vote 4 down vote accepted

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

share|improve this answer
    
Shapely and within did the trick, thank you! –  solr Jul 2 '11 at 12:18
add comment

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

share|improve this answer
    
SELECT * FROM pointstable, polygonstable WHERE st_intersects(pointstable.geom, polygonstable.geom)=TRUE –  Pablo Jul 1 '11 at 22:01
1  
specifically: ST_Contains or ST_Within (possibly ST_DWithin if you want to overcompensate for rounding errors) –  Mike T Jul 1 '11 at 23:10
add comment

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.