Re: [gdal-dev] OGR Geometry methods

2011-07-15 Thread Marius Jigmond
Thanks Frank, excellent tip to be aware of. It's working great now. -marius On Wed, 2011-07-13 at 22:19 -0700, Frank Warmerdam wrote: > On Wed, Jul 13, 2011 at 4:23 PM, Marius Jigmond > wrote: > > aqfeat = aqLayer.GetNextFeature() > > aqgeom = aqfeat.GetGeometryRef() > > geomList = [aqgeom] > >

Re: [gdal-dev] OGR Geometry methods

2011-07-13 Thread Frank Warmerdam
On Wed, Jul 13, 2011 at 4:23 PM, Marius Jigmond wrote: > aqfeat = aqLayer.GetNextFeature() > aqgeom = aqfeat.GetGeometryRef() > geomList = [aqgeom] > > while aqfeat is not None: #loop thru features in case of islands/multiple > polygons >   aqfeat = aqLayer.GetNextFeature() >   if aqfeat is not No

Re: [gdal-dev] OGR Geometry methods

2011-07-13 Thread Marius Jigmond
Frank, thanks for the clarification on iterating over the selection. I was able to run my script and in the simple case of returning one polygon feature it works great. However, I ran into some problems when I tried to assume that the filter would return multiple features. Is it possible to iterat

RE: [gdal-dev] OGR Geometry methods

2011-07-12 Thread Marius Jigmond
Indeed, SetAttributeFilter returns the right feature. Thanks Luke. FYI the ExecuteSQL bug submission is http://trac.osgeo.org/gdal/ticket/4156 -marius Date: Tue, 12 Jul 2011 12:31:03 -0400 Subject: Re: [gdal-dev] OGR Geometry methods From: luke.peter...@gmail.com To: mariusjigm

Re: [gdal-dev] OGR Geometry methods

2011-07-12 Thread Luke Peterson
EPSG3844.shp' shapeDS = ogr.Open(fileName) shapeLayer = shapeDS.GetLayerByIndex(0) shapeLayer.SetAttributeFilter('DENJUD="CLUJ"') targetFeature = shapeLayer.GetNextFeature() print targetFeature.GetField('DENJUD') # should print the DENJUD of the feature fitting the attribute filter. &g

RE: [gdal-dev] OGR Geometry methods

2011-07-12 Thread Marius Jigmond
Date: Tue, 12 Jul 2011 11:36:42 -0400 Subject: Re: [gdal-dev] OGR Geometry methods From: luke.peter...@gmail.com To: mariusjigm...@hotmail.com does executing sql = 'select FID from judeteEPSG3844 where DENJUD = "CLUJ"' return anything?- Luke Peterson 312-533-1051(m)

Re: [gdal-dev] OGR Geometry methods

2011-07-11 Thread Chaitanya kumar CH
Marius, Please do file a ticket with a small shapefile that shows this error. http://trac.osgeo.org/gdal/newticket On Tue, Jul 12, 2011 at 8:30 AM, Marius Jigmond wrote: > ** > After some more investigation that is likely NOT the issue. I have an > ExecuteSQL statement which selects a certain po

Re: [gdal-dev] OGR Geometry methods

2011-07-11 Thread Marius Jigmond
After some more investigation that is likely NOT the issue. I have an ExecuteSQL statement which selects a certain polygon based on an attribute value. Unfortunately it seems to return the wrong feature. The feature I query for is unique so a duplicate is out of the question. Here's the code: #!/u

Re: [gdal-dev] OGR Geometry methods

2011-07-11 Thread Marius Jigmond
I suppose a piece of code speaks louder :): xsect = False for i in range(gridLayer.GetFeatureCount()): feat = gridLayer.GetFeature(i) geom = feat.GetGeometryRef() point = geom.Centroid() for j in range(aqLayer.GetFeatureCount()): aqfeat = aqLayer.GetFeature(j) aqgeom = aqfeat.GetGe

[gdal-dev] OGR Geometry methods

2011-07-11 Thread Marius Jigmond
Hi everyone, I am trying to test whether centroids of polygons lie/intersect within another polygon. I have tried Intersect, Within, and Contains but they always return false. Should these methods work for my intended purpose or do I need to implement a point in polygon function? Thanks. -marius