<div dir="ltr">I have a shape file consisting of thousands of features/polygons.<div>I have to extract only those polygons which are within the reference polygon.</div><div><br></div><div>I tried as follows:</div><div><div>    <br></div><div>refpoly = feat.GetGeometryRef(<wbr>)  </div><div><br></div></div><div>fi =  '<span style="font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">data.shp'</span>

</div><div><div>ids = ogr.Open(fi,0)</div><div>inlay = ids.GetLayer(0)</div><div>for feat in inlay:    </div><div>    ctype = feat.GetField('Name')</div><div>    geomi = feat.GetGeometryRef(<wbr>)</div><div>       if geomi.Within(refpoly):</div></div><div>           write ods....</div><div><br></div><div>But it is running for weeks and not yet finished.<br></div><div>How to do it faster?</div><div><br></div><div>thanks</div><div>Ian </div></div>