I am trying to figure out the syntax for .ExecuteSQL using Python ogr.<br><br>For example:<br>fireLayer.SetAttributeFilter(None) #returns all 2623 polygons<br>fireLayer.SetAttributeFilter(" FIREID < 75 ") #returns 4 polygons<br>
<br>I am trying to get the same results using the ExecuteSQL:<br>testLayer = dataSource.ExecuteSQL("select * from fireLayer")<br>type(testLayer) #retuns NoneType<br>testLayer = dataSource.ExecuteSQL("select * from fireLayer where FIREID < 75")<br>
type(testLayer) #retuns NoneType<br><br>Thanks in advance.<br><br>Dave Verbyla<br><br><div class="gmail_quote">On Sat, Dec 22, 2012 at 7:17 AM, David Verbyla <span dir="ltr"><<a href="mailto:dlverbyla@alaska.edu" target="_blank">dlverbyla@alaska.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><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>
</blockquote></div><br>