[postgis-users] [OT] Extract data from within polygons - not in Postgis

Brent Fraser bfraser at geoanalytic.com
Wed Sep 10 06:50:25 PDT 2008


Chris,

  If you prefer Python, have a look at Shapely (http://trac.gispython.org/lab/wiki/Shapely).  I haven't used it myself, but it looks promising...

Brent Fraser

chlists at me.com wrote:
> Hi list,
> apologies for an off-topic question, but some of you osgeo wizards might 
> know an answer for my question. I need some help to do some 
> geoprocessing _outside_ PostGIS using available open source tools.
> 
> I have two shapefiles - the first one containing 'master' polygons, the 
> second one can contain random features (lines, polygons or points). I 
> now want to iterate through all polygons of the first shapefile and 
> extract the features from the second file which are located within a 
> given master polygon. The extracted features should also get some a new 
> attribute based on which master polygon they are located in. So 
> essentially it is a  simple iteration over a 'within' query.
> 
> Can this be done without converting the shapefiles to a different format 
> using any of the existing open source tools (ogr2ogr, geos, shapely)? I 
> would prefer to use Python, and if possible, the solution needs to be 
> cross-platform (OS X, Win). If not, what would be the best way to do 
> this, preserving the attributes of the shapefiles?
> 
> Any pointers greatly appreciated.
> 
> TIA,
> Chris
> 
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
> 



More information about the postgis-users mailing list