<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I am a newbie to OGR/OSR using Python 2.7.2, please excuse my ignorance:<br>I am trying to find the distance to the closest polygon for each point.  Is there a more efficient way than simply computing the distance to all polygons for each point?  For example:<br>
</blockquote><div> <br>nPts = pointsLayer.GetFeatureCount()<br>nPolys = polysLayer.GetFeatureCount()<br><br>for pt in range(0,nPts):<br>      minDist = 1000000<br>      pointFeature = pointsLayer.GetFeature(pt)<br>      for poly in range(0,nPolys):<br>
            polyFeature = polysLayer.GetFeature(poly)<br>            Dist = pointFeature.GetGeometryRef().Distance( polyFeature.GetGeometryRef() )<br>            if (Dist < minDist):<br>                  minDist = Dist<br>
      print (pt,minDist)<br><br>Thank you.<br><br>Dave Verbyla<br></div></div>