[gdal-dev] Tests if the geometry is within the other geometry

Ian gisplaybox at gmail.com
Fri Jun 22 12:21:38 PDT 2018


I have a shape file consisting of thousands of features/polygons.
I have to extract only those polygons which are within the reference
polygon.

I tried as follows:

refpoly = feat.GetGeometryRef()

fi =  'data.shp'
ids = ogr.Open(fi,0)
inlay = ids.GetLayer(0)
for feat in inlay:
    ctype = feat.GetField('Name')
    geomi = feat.GetGeometryRef()
       if geomi.Within(refpoly):
           write ods....

But it is running for weeks and not yet finished.
How to do it faster?

thanks
Ian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20180623/0cb6f697/attachment.html>


More information about the gdal-dev mailing list